Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to run a command at boot time that basically looks like this:

python /home/me/.hidden/commnd.py

Also, this needs to run as me, not root.

I know it can be done, but my google-fu is weak today.

BTW, this is a headless server, so starting at login isn't a solution.

share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

You can use the @reboot cron target.

Edit your user account crontab by using the crontab command:

$ crontab -e

Then instead of minute hour day month day of week, simply put @reboot

@reboot python /home/me/.hidden/command.py

For more info on @reboot and other cron special strings, read the crontab 5 manpage.

$ man 5 crontab
share|improve this answer
    
This worked for me. As a note: the python script I was using didn't like to be called the way I had it listed above, so I created a simple script that cd'd into the directory then called the python script. –  Tymanthius Feb 25 '13 at 13:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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