Community discussions

 
Guentha
just joined
Topic Author
Posts: 13
Joined: Thu Apr 17, 2014 8:47 pm

Run Script on Login of any user

Tue Jun 05, 2018 12:44 am

I have read 40 bazillion posts now of people asking the same question and there never seems to be a straightforward answer.

I have a backup script that I can schedule to run monthly but we keep running into that not being fast enough but I don't want to keep increasing it as I don't want a million backups stored on our servers.

the problem is always a new tech logging in, breaking something, then saying they didn't do anything and we have to revert back to last months backup which may be several iterations old and take up the time of the better techs figuring out what needs to be fixed.

what I need is a way to launch our backup script anytime someone logs into winbox so I have the most recent config.

Our script is just called backup and takes about 10 seconds to backup and FTP the configs to our servers.
 
samsung172
Forum Guru
Forum Guru
Posts: 1186
Joined: Sat Apr 04, 2009 3:45 am
Location: Østfold - Norway
Contact:

Re: Run Script on Login of any user

Wed Jun 06, 2018 1:14 am

Tell all tech to make a backup after login. setup a syslog server - make user/pass to all of your staff - and have em login by that. (radius is a nice thing) if syslog server have a login but no backup - fire the employee - and hire someone taking the job seriously.
 
Guentha
just joined
Topic Author
Posts: 13
Joined: Thu Apr 17, 2014 8:47 pm

Re: Run Script on Login of any user

Wed Jun 06, 2018 1:30 am

Tell all tech to make a backup after login. setup a syslog server - make user/pass to all of your staff - and have em login by that. (radius is a nice thing) if syslog server have a login but no backup - fire the employee - and hire someone taking the job seriously.
If only life was that easy. Finding people trustworthy to not mess with clients data is hard enough these days that I cant be firing Techs every week. I know it sounds simple to just take a backup but can you honestly say you take a backup every time you log in to a router or switch? I know I cant. this is why I need to take the human element out of it and just have backups on login.
 
2frogs
Long time Member
Long time Member
Posts: 540
Joined: Fri Dec 03, 2010 1:38 am

Re: Run Script on Login of any user

Wed Jun 06, 2018 5:01 am

If you set the backup names to the identity of the device and use unique identities, you should be able to do your backups nightly and will be over written on your server. I do this with nightly exports.
 
Guentha
just joined
Topic Author
Posts: 13
Joined: Thu Apr 17, 2014 8:47 pm

Re: Run Script on Login of any user

Wed Jun 06, 2018 5:08 am

We use unique names for each backup specifically so we dont overwrite the last file. Sometimes it's weeks before we know there is a.problem on complicated equipment. Some of our cars have hundreds of rules and 10s of thousands of address lists. Nightly would only work if we where willing to keep hundreds of backups. We have the space and bandwidth but this seems crazy.is there really no way to run a script on login? This seems so intuitive I was baffeled it didn't already exist. I can think of a ton of stuff I would like to happen on login. We
 
2frogs
Long time Member
Long time Member
Posts: 540
Joined: Fri Dec 03, 2010 1:38 am

Re: Run Script on Login of any user

Wed Jun 06, 2018 8:24 am

:do {:if ([/user active print count-only]>0) do={/system script run backup; :delay 30m;}} while=(true);
It's not full proof, but works. Just schedule it at startup. If you are using the Dude, you will need to increase the 0 to 1. You can also increase it to 1 and test the script from winbox by opening a New Terminal. And set the delay to your liking, it will just continually run while a user is logged in without it.

Who is online

Users browsing this forum: No registered users and 8 guests