Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a shell script on FreeBSD that sends a few screen stuff commands to a running screen session (which runs a Minecraft server). The commands work when I execute it manually.

But if I put the same script into the same user's crontab, it does execute but the screen stuff commands don't reach the running screen process.

I've checked /var/log/cron and even >>'d output to a log file and I saw that the parts of the script that have nothing to do with the screen commands do actually execute.

My shell script looks like this:

screen -S minecraft -X stuff "say Server is going to render the world now.
"
screen -S minecraft -X stuff "say You might feel some slight turbulence.
"
screen -S minecraft -X stuff "save-all
"
screen -S minecraft -X stuff "save-off
"
cd /home/minecraft/bin/mcmap-src
./mcmap /srv/minecraft/cascada
screen -S minecraft -X stuff "save-on
"

Can anyone help me with this?

[EDIT]

Oops it turns out it has nothing to do with the executing user, but everything with having to use the path "/usr/local/bin/screen" instead of just "screen".

Fixed!

share|improve this question
3  
Please convert your edit into an answer for you question and when you can accept it - thanks –  Iain May 11 '11 at 12:18
    
I always remember to use the full path instead of just command name in the cron job. –  quanta May 28 '11 at 17:39

1 Answer 1

From the edit to the question.

It turns out it has nothing to do with the executing user, but everything with having to use the path "/usr/local/bin/screen" instead of just "screen".

share|improve this answer

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.