Results 1 to 3 of 3

Thread: Problems with backgrounding scripts in cron

  1. #1
    Join Date
    Jan 2012
    Beans
    1

    Problems with backgrounding scripts in cron

    Hi

    I have a script which I call from cron which causes another script to be run in the background:

    #!/bin/bash
    bash /usr/local/bin/generateOutput &

    The script generateOutput simply echos a text string.

    When called from the command line I see the output whether or not generateOutput is backgrounded. When called from cron, and generateOutput is backgrounded I do not get the resulting output emailed to me as I would expect.

    Has anyone seen this before and can you suggest how to capture STDERR and STDOUT from generateOutput and return it to the cron?

    Many thanks

  2. #2
    Join Date
    Oct 2008
    Location
    Stuttgart, Germany
    Beans
    441
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Problems with backgrounding scripts in cron

    See here first:
    https://help.ubuntu.com/community/Cr...ommon_Problems

    are you running the cronjob as a regular user?

    what is your cron entry?

    have you tried to tee stdout & stderr to a file as well?

    have you checked /var/log/ auth.log and syslog?

  3. #3
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,505
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Problems with backgrounding scripts in cron

    Quote Originally Posted by Wayne_V View Post
    ........
    have you tried to tee stdout & stderr to a file as well?

    have you checked /var/log/ auth.log and syslog?
    Or have you asked your tutor?
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

Tags for this Thread

Bookmarks

Posting Permissions

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