Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Using cron for auto tasks
Results 1 to 6 of 6

Thread: Using cron for auto tasks

  1. #1

    Using cron for auto tasks

    There are some things that I want to run automatically, like my email program starting at least an hour before I get up and then downloading my email ready for me. So I have made the following cron file which is in /etc/cron.daily
    ========================
    # DO NOT EDIT THIS FILE - edit the master and reinstall.
    # (/tmp/croninit installed on Mon Feb 23 12:02:14 2004)
    # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
    MAILTO=""
    LANG="en_UK"
    0 0 7 * * /usr/local/bin/sylpheed
    ========================
    and called 'boztu.cron'

    In the morning I read in my Cron-parts email ... /etc/cron.daily/boztu.cron:
    /etc/cron.daily/boztu.cron: line 6: 0: command not found

    and it hasn't run. The permissions on boztu.cron are rwxr-xr-x with the owner and group being both boztu.

    Why doesn't it run please, and what do I need to do to get it to run please?

    BTW, I'm using White Box Enterprise Linux 3.0 [essentially just RHEL3 but rebadged ], and I'm still very much a noobie to Linux

    Sharon.



  2. #2
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811

    Re:Using cron for auto tasks

    move the file to your $HOME or where you want it to be, then issue the command: crontab -u [user] <the_file>
    That should be enough to ensure sylpheed will be initiated as that user every day at 7am.
    The only problem you might face, will be not to have a valid $DISPLAY when cron decides to run the command.
    Things saved in /etc/cron.daily will be run as root every day when cron is running, could be at 4am or whenever cron is active.
    Those files should only contain the scripts/programs that needs to be run, not info to cron on when to use it.
    http://www.linuxjunior.org/cgi-bin/p...play&id=69

  3. #3

    Re:Using cron for auto tasks

    [quote author=redhead link=board=1;threadid=8760;start=0#msg79137 date=1077809037]
    move the file to your $HOME or where you want it to be, then issue the command: crontab -u [user] <the_file>
    That should be enough to ensure sylpheed will be initiated as that user every day at 7am.
    The only problem you might face, will be not to have a valid $DISPLAY when cron decides to run the command.

    Thanks for this, you were exactly right, it runs but doesn't display Any ideas please how I can get this program to display?

    Its all part of my strategy to get a good up-to-date, working box, and then give it to my 72yo mother to use for her daily activities. The next thing to get working is a backup system.

    Sharon.

    [/quote]

  4. #4
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811

    Re:Using cron for auto tasks

    [quote author=sharon63 link=board=1;threadid=8760;start=0#msg79142 date=1077812742]
    Thanks for this, you were exactly right, it runs but doesn't display Any ideas please how I can get this program to display?
    [/quote]
    The part of the problem you face here, is that any user on a machine will only be assigned a valid $DISPLAY when they are loged in, since cron is running in a system space as the user, and not initiated from a shell by the user, it will not enherit the users $DISPLAY required by any GUI program.

    One way you can achive the desired result, is to use fetchmail and have cron invoke that at any given time.
    I would suggest to have the cron entry like this:
    @reboot /usr/bin/fetchmail -s -d 600 --syslog -f /my/fetchmail.rc-file
    This will ensure fetchmail to be invoked when the machine is booted, rettrieve mails every 10 minuts, and be quiet about any errors.

    Your fetchmail.rc file could look something like this:
    Code:
       poll mail.provider.net with proto pop3:
                user "mymother" there has password "u can't krak this"
                               is mother here and wants mda "/usr/bin/procmail"
    Now fetchmail will use procmail for local delivery, and you can setup procmail to filter any unwanted spam messages from your mothers mail, by using spamassassin in combination with procmail.

    In order to give your mother the view as if it's her beloved M$ outlook she's still using, you will configure sylpheed to check the local mail-queue instead of polling the mail from some pop3 server, now she will get her mail eventho she hasn't started sylpheed.

    Remember to configure the WM like winXP and your mother wont suspect a thing, apart from the login screen which greets her every time she boots the machine.
    [quote author=sharon63 link=board=1;threadid=8760;start=0#msg79142 date=1077812742]
    The next thing to get working is a backup system.
    [/quote]
    You could use iBackup very easy to use with cron aswell.

  5. #5
    Mentor coltrane's Avatar
    Join Date
    May 2001
    Location
    North Carolina
    Posts
    1,390

    Re:Using cron for auto tasks

    brilliant

  6. #6
    Moderator
    Advisor
    redhead's Avatar
    Join Date
    Jun 2001
    Location
    Copenhagen, Denmark
    Posts
    811

    Re:Using cron for auto tasks

    [quote author=coltrane link=board=1;threadid=8760;start=0#msg79176 date=1077884106]
    brilliant
    [/quote]
    Thanks coltrane, I know I havn't been around here much lately (as in a year or more) but it seems as if the guidence hasn't failed me yet.

Similar Threads

  1. Crontab - Scheduling tasks.
    By peter in forum Tutorials
    Replies: 0
    Last Post: 11-24-2008, 05:35 AM
  2. Completed Tasks Do Not Appear
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-01-2005, 03:08 AM
  3. Linux machine for serveral tasks
    By monkeywork in forum Linux - General Topics
    Replies: 8
    Last Post: 11-23-2003, 06:46 AM
  4. Crontab - Scheduling tasks.
    By pbharris in forum Linux - General Topics
    Replies: 2
    Last Post: 07-16-2002, 06:46 PM
  5. scheduling tasks
    By cameron in forum Linux - General Topics
    Replies: 6
    Last Post: 03-22-2002, 06:22 PM

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
  •