Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

beginner here. I have a script called 

It's contents

/etc/init.d/srcds stop
./steamcmd/sh +login anonymous +force_install_dir ./tf2 +app_update 232250 +quit
/etc/init.d/srcds start

Located here


If I run ./ from terminal it asks for a password, I type it in, and the script runs successfully.

When I put it in sudo crontab -e like this

10 9 * * * /home/user/

It doesn't run.

What am I doing wrong? I've seen simular tickets about this topic on here but have not seen a clear answer. Thanks for the help.

share|improve this question

This is a very very common mistake. You need to use the full path in scripts (rather then the relative path).

chron runs with sh using minimal environmental variables.

share|improve this answer
So I should change my script to this #!/bin/bash /etc/init.d/srcds stop /home/user/steamcmd/sh +login anonymous +force_install_dir /home/user/tf2 +app_update 232250 +quit /etc/init.d/srcds start – vapidit Jan 10 '14 at 19:10
Yes give it a try with the full path – bodhi.zazen Jan 10 '14 at 19:12
I changed it but not sure if it works. Is there a way to output to the screen so I know that it ran or not? Examples would be appreciated. Thank you. – vapidit Jan 10 '14 at 19:27
grep /var/log/syslog , see also… – bodhi.zazen Jan 10 '14 at 19:37

Your Answer


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.