Find the answer to your Linux question:
Results 1 to 5 of 5
Hi, I want cron to execute a script at a certain time which sends a command to a detached tmux/screen session. I have already started a session with "tmux new ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2011
    Posts
    4

    Exclamation crontab does not execute script or command containing tmux or screen?


    Hi,

    I want cron to execute a script at a certain time which sends a command to a detached tmux/screen session.

    I have already started a session with "tmux new -d -n stuffn -s stuffs "blah" OR screen -dmS stuffs blah.

    I then put "tmux send -t stuffs:stuffn "blah" C-m OR screen -x stuffs -X stuff "blah" in a script to send command to detached session. I ran the script manually it worked but when put in cron nothing happens. The cron script looks like "46 17 * * * /bin/sh /location/script.sh".

    Putting the command directly in cron also doesnt do anything. I am sure cron is working itself.

    Does anyone have an idea of whats going on?

    Thanks in advance!

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    w/out looking at the screen/tmux stuff, what about redirecting the output of your cronjob to a log and see what it says? e.g.:

    Code:
    46 17 * * * /bin/sh /location/script.sh > /tmp/script-out.log 2>&1

  3. #3
    Just Joined!
    Join Date
    May 2011
    Posts
    4
    Quote Originally Posted by atreyu View Post
    w/out looking at the screen/tmux stuff, what about redirecting the output of your cronjob to a log and see what it says? e.g.:

    Code:
    46 17 * * * /bin/sh /location/script.sh > /tmp/script-out.log 2>&1
    THanks but i have already found the solution. I have to run the command as_user

  4. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    that is good!

  5. #5
    Just Joined!
    Join Date
    May 2011
    Posts
    4
    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •