View Single Post
Old 2022-08-03, 19:29   #9
EdH's Avatar
"Ed Hall"
Dec 2009
Adirondack Mtns

2×5×7×73 Posts

Originally Posted by paulunderwood View Post
I see this as two problems: Firstly getting something to run at boot and secondly getting something to run when logging in.

For the first use @reboot su math-user -c "X" (in sudo crontab -e) where X is uses the screen command to run your program.

Secondly, use the xterm command (or whatever) with the screen command again to see the status of your process. This command string can be put into your .bashrc file on the target machine.
I tried all kinds of variations in the root crontab file, with no success. I did have success in making sure @reboot does something by having it create a file. (I didn't try that in the user crontab yet.) I did install screen since that's where everyone is pointing me. Both screen and tmux run using the command I'm adding to the root crontab, but neither work from @reboot.

As to the second, I'm not familiar with .bashrc, but doesn't that just affect the behavior of bash when run? I'm guessing the first needs to work before the second is useful.
EdH is offline   Reply With Quote