So I am trying to run a script as a specific user @boot.
I have come across using @reboot in conjunction with crontab.
I have found that @reboot is supported by both the user and root via
@reboot echo "hello" > /root/hello.sh
and same for a regular user and the hello.sh file appeared after reboot
But if I try (tried both with roots crontab and users crontab)
@reboot ~/.reboot.sh
or
@reboot /home/user/.reboot.sh
or
@reboot user /home/user/.reboot.sh
Nothing!
Also the script works via
~/.reboot.sh
&
/home/user/.reboot.sh
in CLI environment. Again this can't be run as root, needs to be run by the user!
[Update]
The specific command I want to run is
VBoxHeadless --startvm VMNAME
And via crontab this works
*/1 * * * * VBoxHeadless --startvm VMNAME
But this does not?!
@reboot VBoxHeadless --startvm VMNAME
[update2]
This works
@reboot /home/user/.reboot.sh
when .reboot.sh contains
echo "hello" > /home/user/hello.sh
So this is a problem with the VboxManage command specifically. Perhaps it lags at boot? Any thoughts are appreciated, but I think I need to look into specifically the command VboxManage, tho I did master running command @ boot as a user today! Just found this command didn't work!