0

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!

1

I think the vbox modules just isn't available in time of execution. Why don't you create a service? Refer to corresponding documentation of your init system.

  • Yea I finally figured it out, the life of a computer guy, had 2 restart 20 times via process of elimination I figured that out! Thanks tho, I did research about a VboxAutoStart command, but I wanted to mash together mastering running something a boot then I could just edit .reboot.sh but sounds like I need a seperate set up just for Vbox.... I also read that VboxAutoStart isn't installed by default anymore fun times! – FreeSoftwareServers Oct 24 '15 at 1:20
  • Are you saying like create an init.d script? – FreeSoftwareServers Oct 24 '15 at 1:21
  • Yes, for example. You just need to correctly handle dependencies, you may enable it for runlevel '5'. – Yurii Kolesnykov Oct 24 '15 at 1:30
  • Thanks, this is what I finished with! Upstart Script – FreeSoftwareServers Oct 24 '15 at 2:38
  • NM, It's pleasure for me that I can help you. – Yurii Kolesnykov Oct 24 '15 at 2:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.