0

beginner here. I have a script called

updateTf2.sh 

It's contents

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

Located here

~/home/user/updateTf2.sh

If I run ./updateTf2.sh 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/updateTf2.sh

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.

0
2

The commands executed by cron don't have a terminal connection, so they cannot interactively ask for user responses. If the desired remote server asks for a password with anonymous login you will have to use another mechanism to authenticate the program steamcmd.sh, like configuring it to use some Steam AppID as depicted in How to install and use SteamCMD.

0

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.

4
  • 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 – Panther 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 updateTf2.sh /var/log/syslog , see also askubuntu.com/questions/149504/… – Panther Jan 10 '14 at 19:37

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.