You are not logged in.
Hi,
I use some Bash scripts to make backups of my data using rsync and cp -l.
To decide at boot time, if a backup should be made, I append DOBACKUP=yupp (yupp=yes, see problem below) to the kernel line in Grub. The variable DOBACKUP can be accessed within the init environment. I added a simple rc.d scripts that checks if the variable is set and starts the backup. However, this is not the nicest way, since the boot of the system is not finished yet. If the backup script hangs, I don't have any console. How can I execute a program after the computer is booted?
Furthermore, I don't want to execute the backup script in the background, since it asks for some user input.
What is the correct way in doing this?
Another strange behavior occurs, if I set DOBACKUP=yes. In this case, I get a blank screen and not boot output is shown (but it seems that the computer boots correctly, just without any output on the monitor). Thus I use yupp instead of yes to indicate the need for a backup: DOBACKUP=no or DOBACKUP=yupp work both as expected.
Sven
Offline
I don't want to execute the backup script in the background, since it asks for some user input.
Seems clear to me that you need a logged-in user to provide user input - run the script from your shellrc at login time.
Offline
avanc wrote:I don't want to execute the backup script in the background, since it asks for some user input.
Seems clear to me that you need a logged-in user to provide user input - run the script from your shellrc at login time.
Either that, or the script should be refactored to not require user input.
Also, the kernel command line is always available via /proc/cmdline.
Offline
Also, this is not a General Programming issue, moving to Workstation User.
Offline
tomk wrote:avanc wrote:I don't want to execute the backup script in the background, since it asks for some user input.
Seems clear to me that you need a logged-in user to provide user input - run the script from your shellrc at login time.
Either that, or the script should be refactored to not require user input.
Deamonize the backup script? In that case I don't get any feedback if everything works fine.
My intention is to install arch on a USB disk. A windows user can plug the disk in and start the computer. Arch Linux is booted from the USB disk and the backup is automatically started. However, a short message that everything worked fine before the script shuts the PC down would be preferable.
To keep the backup simple, the login idea is also not the best choice...
Offline
Send an email notification whether it succeeded or not. That way, you wouldn't need user intervention, nor would you have to sit and wait for it to finish. Simply check your email to find out.
And if the system is not on the net, well, you can always store such notifications on the flash drive.
Knute
Offline
If you don't want to receive an email or don't have sendmail (or similar) intalled on your system you could of course also think about creating a log file.
Offline
Sure, a logfile is created. But hwo often do you check those ;-)
Another idea that came into my mind: Can a add another program instead of agetty in /etc/inittab? Of course without respawn...
Offline