You could put your sys_backup script (or a link to it) in /etc/rc3.d and call it something like S99sys_backup. This will then only kick in once the other processes in the startup procedure have completed and the system is effectively up. HTH.
Thankyou so much.
I donot know how to make the link or call.
can you pls give me idea of that . Also one query
If i follow Like that then if any emergency reboot / or any maintenance reboot /shutdown is done then sysbackup would run. that is not good.
I want to Add in crontab file . how i can do it ??
Rightnow in crontab file there is schedule reboot script
as well as sysbackup script which runs at 3 and 5 o'clock.
i wana add some thing that way once machine is up /system is ready then starts sysbackup..automatically.
i think you got idea what i mention. if not let me know i will give more Information.
Thanks a lot for your help.
rockies
mmpatel345@yahoo.com
Pleased to help. As far as the first question is concerned, it is normal practice to put a copy of your script (sys_backup or whatever) in the directory /etc/init.d
You then create a link from /etc/init.d to /etc/rc3.d as follows:
This creates a virtual copy of your sys_backup file in the /etc/rc3.d directory.
You are quite correct in your assumption that in these circumstances the backup script would run following an emergency reboot or power outage. I'll need to have a think about your crontab requirement (it's getting late here!), but it's entirely possible that someone else might be able to help you whilst I'm in the land of Nod!
The crontab file can erase a flag type file when it reboots. After the reboot the rc3.d startup script can look for this flag/file and do a backup if it is not detected. Otherwise the startup script does nothing. At the end of performing a backup, the startup script can set the flag/file.
Thanks to Bluedevils ,KenCunningham for help.
Bluedevils,
Can you tell me how i can modify it.
i donot know how it works . If you tell something I can Test
on test server
Thanks.
I have never done this so here's another version that might work.
1)make a template file with the backup commandline (the same command in your etc/init.d/sys_backup)
2)just before the cronjob does a reboot it can copy the backup command into the flag/file. "cat backup.template > backup.flag"
3)In the startup script you can have lines like "/<path>/backup.flag" and "cp /dev/null /<path>/backup.flag" This will run the backup and then empty the file. The next time when there is an unscheduled reboot, there will not be a command to execute in the backup.flag file.
If my understanding is correct, kind of what bluedevils meant was to edit your shutdown cron script to include writing a 'flag' file when it begins to shutdown. This will place a file wherever you like which can then be tested for existence by a script in rc3.d when the system comes back up. If the file exists, it is clear that the system shutdown was as a result of the normal cron job, rather than an unscheduled halt, and the same script could then kick off the backup.
The backup script would need to be amended to include provision to delete the flag file once it is finished. If the system goes down as a result of an unscheduled halt, the flag file wouldn't exist and the startup script should be such that in this event the backup would not be kicked off. Can you post your shutdown and backup scripts if you require further advice, please? Hope this helps.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.