Cron jobs and crashes

I have a script that I wrote to backup a server at midnight every night. It uses rsync to perform the backup. The past two nights it has run it seems to cause the server to crash. I used the Terminal to setup a cron job to run the script. Does this sound like a serious error or am I doing something completely wrong, or should it maybe be done at a different time? I looked through the logs and the kernel seems to panic and call crashdump or panicdump.
The system in question is a Mac Mini if it makes any difference. If anyone would like I could post the script.
Tom

Here is the script file. I tried changing the time the script is run from midnight to 1AM and it ran the problem was that it ran about 60 times!!!!
Is this a problem with the cron job because I see no problems with my script. I can successfully run it from the command line.
#!/bin/bash
DIRS=(/Applications /Developer /Groups /Library "/Shared Items" /System /Users /bin /opt /private /sbin /sw /usr)
###### DON'T CHANGE BELOW HERE ######
LOGS_DIR="/Library/Logs/Backup"
MACHINE=`hostname -s`
RSYNC_FLAGS=" -avz -e ssh --eahfs --delete" # These shouldn't need changed
DATE=`date +%m%d%G`
RSYNC_BIN="/usr/local/bin/rsync"
if [ ! -d "$LOGS_DIR" ]; then
mkdir $LOGS_DIR
fi
if [ -z "$1" ]; then
echo "usage: $0 <daily|weekly>"
exit
fi
TYPE=$1
if [ "$TYPE" = "daily" ]; then
TYPE="Daily"
elif [ "$TYPE" = "weekly" ]; then
TYPE="Weekly"
else
echo "Bad Option please use daily or weekly"
exit
fi
BACKUP_DIR="146.186.147.152:/Volumes/Backups_${TYPE}/${MACHINE}/"
#echo "${RSYNC_BIN} ${RSYNC_FLAGS} "${DIRS[@]}" ${BACKUP_DIR} >& ${LOGS_DIR}/${TYPE}_${DATE}.log"
#${RSYNC_BIN} ${RSYNC_FLAGS} "${DIRS[@]}" ${BACKUP_DIR} >& ${LOGS_DIR}/${TYPE}_${DATE}.log
#echo "${RSYNC_BIN} ${RSYNC_FLAGS} "${DIRS[@]}" ${BACKUP_DIR}"
${RSYNC_BIN} ${RSYNC_FLAGS} "${DIRS[@]}" ${BACKUP_DIR}

Similar Messages

  • Cron Job and PHP

    I am having problems running a cron job every one minute that calls a PHP script. Please see below:
    1 * * * * /usr/bin/php /Library/WebServer/Documents/secureohs/publichtml/reassignMSCcomptrack.php
    If I execute the command above, it runs just fine.
    Thank you in advance.

    I guess it would :)
    btw, how did this piece miss from the contents pasted by the OP ?
    The doc has given all details of CRON and missed where to see the logfiles. :)
    ****Added****
    I tried man crontab in windows, i dont see it.i overlook most of the things, i would have done the same ;)
    Edited by: Bobcatalog on Oct 23, 2008 9:40 AM

  • Cron job and daylight savings time

    What is the behaviour of cron when the time changes from daylight savings time to standard time and vice versa ?

    This has been discussed at length in
    http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=1&catid=7&threadid=12 44419&highlight_key=y&keyword1=dst

  • Cron Job in Root Directory

    I am running OS 10.4.6 on a Mac G4 450MHz machine. Recently when I opened Activity Monitor I noticed a cron job showed up in the root directory that hadn't been there before. I know I can select the cron job and then click on the Inspect icon but the dialogue boxes that show up do not tell me anything about the cron job except statistics having to do with CPU or memory usage. How do I find out what the cron job is and what it does? Is having a cron job in the root directory normal for 10.4.6? If it's not supposed to be there, how do I get rid of it?
    Thanks for your help.
    G4   Mac OS X (10.4.6)   450MHz with 768MB of RAM

    David,
    I think you are seeing the cron daemon. Not a "cron job". The cron daemon is started during the boot process. Cron then reads /etc/crontab. Crontab list "jobs" to be run and at what time. As of Tiger cron has been demoted and launchd handles running "jobs". Cron is still started at boot time but does nothing. It runs for backwards compatibility. There's nothing to get rid of- just leave it alone.

  • Help Please : Cron Job to automate load process

    Hi
    I am trying to automate data load process. I am loading data into a number of tables from flat files.
    Currently I have a UNIX (SunOS) file with a bunch of SQLLDR commands and I changed permission on this file to executable. Every morning I execute this file to load data.
    Now I want to automate this process by writing a cron job and scheduling it. I am running into a number of problems. I exported ORACLE_SID, ORACLE_HOME and PATH still cron is unable to find SQLLDR.
    Whatelse am I missing. Here is my command file and cron file.
    Please help!?!?!?
    ORAENV VARiables
    export ORACLE_HOME=/export/opt/oracle/product/8.1.6
    export ORACLE_SID=fid1
    export PATH=$PATH:$ORACLE_HOME/bin
    .profile
    . $HOME/oraenv
    daily_full.sql file
    export ORACLE_SID ORACLE_HOME PATH
    sqlldr userid=user/pwd control=acct.ctl log=acct.log
    sqlldr .......
    Cron Job
    16 11 * * 1-5 /apps/fire/data/loadscripts/daily_full.sql >> /apps/fire/data/loadscripts/fulllog.log 2>&1
    Output fulllog.log file
    /apps/fire/data/loadscripts/daily_full.sql: sqlldr: not found
    /apps/fire/data/loadscripts/daily_full.sql: sqlldr: not found
    Thanks
    Shanthi

    Hi Ramayanapu,
    first; you have written a shell-script not an sql-script. Please rename your file from daily_full.sql to daily_full.sh
    I suggest that you use the cronjob from a user who has the enviroment with the variables ORACLE_SID and ORACLE_HOME.
    In this case cron will operate from the $HOME variable of this user.
    Perhaps your export will destroy the .kshrc setting. The statement has no effect in your script, please remove it.
    Rename your sqlldr-Statement as follows;
    $ORACLE_HOME/bin/sqlldr userid=user/pwd control=<path>acct.ctl log=acct.log
    <path> will placed with the path of your controlfile.
    Your user/pwd will correspond with a ORACLE user who has the right to insert in the destination table.
    Your logfile will be place in the %HOME directory.
    Hope that i could help to solve your problems
    with kind regards
    Hans-Peter

  • Should I use the built in log rolling function on iWS 6 or roll my own using a cron job using stop and start scripts in the web server instance root?

     

    Hi,
    You can use either OS cron job based log rotation
    OR
    Internal daemon log rotation.
    It is recommeded to use OS cron job log rotation.
    OS=Operating System
    Regards,
    Dakshin.
    Developer Technical Support
    Sun Microsystems
    http://www.sun.com/developers/support.

  • Cron job not running - script uses rsync, ssh (with id_rsa)

    Does anyone know how to get cron to run a rsync/ssh script which uses id_rsa for passwordless logins?
    I have a backup script I have slaved for months over that works wonderfully when running it from the command line.
    It uses rsync and connects with SSH (passwordless using ssh keys). I have setup id_rsa and id_rsa.pub for passwordless logins (this is my user account, and connects using root@ to the server)
    As stated all works find when run from the command line. But when I setup a cron job to run this file (exact same line I run from the command line) it does not execute. Actually, it does run, as I have an email notifiction which sends to me. It is just the rsync/ssh part that does not run.
    I have spent days and days trying to figure it out. No error messages occur, nothing.  Took me a while to find out cron is emailing the user account on Lion the messages (not to a proper email address).
    The error shows a permission denied, which I believe to be the cron user cannot use the id_rsa/ssh connection.
    Cron is running the script as my user, the same I use on the command line. I even tried copying the id_rsa to the root user .ssh folder in case cron is running as root but that does not work either.
    So does anyone know how to get cron to run this rsync/ssh script which used id_rsa for passwordless logins?
    Thanks a lot

    YES! Got it working, finally!
    So the issue is indeed cron/launchd not being able to access the ssh-agent which holds the key.
    So this is the solution...
    Download keychain for Mac:
    http://www.funtoo.org/wiki/Keychain
    Then once its installed and configured, the script to run needs this added to the top:
    eval `keychain --noask --eval id_rsa` || exit 1
    Note I am using id_rsa whereas keychains instructions refer to id_dsa so I just changed it and it works OK.
    When the script runs the first time it asks for the key password. Then it works from then on.
    What I do not know yet is will I need to re-enter the password when I logoff/logon again. That will cause an issue as I auto restart the Mac every day which means if I am off for a few days backup will stop (can you see the madness in this issue!).

  • How to take the cron job log in HP UX?

    Hi,
    How to take the cron job log in HP UX
    I need to run a backup and other stuff everyday. How do I check and start cron service under HP-UX UNIX operating system? How do I write cron jobs?
    A. Cron service is required to run jobs and tasks such as backup.
    You must login as the root to run following commands. Each user that is using the cron service must have a cron configuration file in the /var/spool/cron/crontab directory. Also users are permitted if their name appeared in /var/adm/cron/cron.allow file
    Task: Find out if cron is running under HP-UX
    Type the following command at a shell prompt
    # ps -ef | grep cron
    Open /etc/rc.config.d/cron file
    vi /etc/rc.config.d/cron
    Set control variable to 1 to enable cron: CRON=1
    Set control variable to 0 to disable: CRON=0
    Close and save the file. To start or stop cron you can type the following command:
    # /sbin/init.d/cron start <-- start cron
    # /sbin/init.d/cron stop <-- stop cron
    Task: HP-UX Start cron service
    If cron is not running, simply type:
    # cron
    Task: Edit / create cron jobs
    Type the following command to submit a cron job:
    # crontab -e
    List your cron file:
    # crontab -l
    Backup all your cron jobs:
    # crontab -l > ~/backup.cron.jobs
    Remove ALL cron job:
    # crontab -r
    Task: Crontab file format
    Cron file format is as follows:
    MIN HOUR DATE MONTH DAY /PATH/TO/COMMAND
    0-59 0-23 1-31 1-12 0-6 /root/scripts/backup2tape.shEasy to remember crontab file format:
    * * * * * command to be executed
    | | | | |
    | | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
    | | | ------- Month (1 - 12)
    | | --------- Day of month (1 - 31)
    | ----------- Hour (0 - 23)
    ------------- Minute (0 - 59)To run /root/script/backup at 23:00, every day, enter:
    # crontab -e
    Append following
    0 23 * * * /root/script/backupRun foo job very weekday (MON-Fri) at 6am, enter:
    0 6 * * 1-5 /root/script/backupFor more information refer to cron and crontab man pages.
    Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.
    Related Other Helpful FAQs:
    What is Cron?
    Linux Start and stop the cron or crond service
    Run crontab Every 10 Minutes
    Linux / UNIX Setup and run php script as a cron job
    Stop Ubuntu / Debian Linux From Deleting /tmp Files on Boot
    Discussion on This FAQDavid Says:
    January 15th, 2008 at 12:21 am
    You might note that all files normally found in /etc/init.d, /etc/rc*.d, and others are all in /sbin in HP-UX 10.20 and up.
    Note too that your formatting is off in the description of the /etc/rc.config.d/cron file. Also, if you run /usr/bin/cron instead of /sbin/init.d/cron start, the /etc/rc.config.d/cron file is not used.
    Regards,
    Satya

    I guess it would :)
    btw, how did this piece miss from the contents pasted by the OP ?
    The doc has given all details of CRON and missed where to see the logfiles. :)
    ****Added****
    I tried man crontab in windows, i dont see it.i overlook most of the things, i would have done the same ;)
    Edited by: Bobcatalog on Oct 23, 2008 9:40 AM

  • Need help with a cron job

    What I want to do is run an Applescript every 6 hours and 1 minute. If the computer is asleep when the job comes due, I want it to execute the script and reset the counter. Can crontab do this? If so, how to set it up?

    Gnarlodious wrote:
    Then skip it, I can see there is no easy way.
    I don't think it's that hard, though. Just a bit tricky. I was just a bit confused on what exactly you wanted.
    I could write a stay-open Applescript application, but I wanted to avoid cluttering up the Dock just to run a command every 6 hours.
    Nah, I wouldn't want that either.
    If I were doing something like this and I wanted it to work like this:
    1. Run every six hours, at 6 AM, noon, 6 PM, and midnight.
    2. Run after waking up if the computer has been asleep and missed any of the times in between, say if you let the computer sleep thru the 6 AM job.
    I'd do this:
    1. Call the AppleScript periodically from a cron job. How often would be dependent on how tight you want the times to be to when you wake up.
    2. Have the AppleScript save a text file somewhere with the time when it runs. That way, if your computer is asleep at 6 AM, the script could use this to decide if it missed running while it was asleep.
    3. Have your script check this time and if it's over 6 hours, let the script do its thing. If not, then just exit, to try all this again the next time cron runs it.
    Here's kind of a pseudo-code way of describing it:
    check if it's 6:01, 12:01, 18:01, 00:01
    if yes:
    do your AppleScript business
    save the current time in a file
    exit
    if it's not one of those times:
    check if it's been over 6 hours since the AppleScript did its business
    if yes:
    do the AppleScript business
    save the current time in a file
    exit
    if no:
    exit
    Then you could do two cron jobs:
    1 */6 * * * /path/to/applescript
    */5 * * * * /path/to/applescript
    The first one would run at your appointed times. The second would just run every 5 minutes to catch those times when the computer was asleep. The "5" could also be "10" for every ten minutes. Or whatever you decide you'd like.
    I'd show you an AppleScript, but I'm really not so good at that. If a Perl script would help, I could whip one up pretty quickly, I think.
    charlie

  • Is it possible to have a Cron job in CPO to check the running status of a workflow

    Is it possible to have a Cron job in CPO to check every hour to see if a particular workflow is running, if not trigger it by creating a alert, if yes- autokill

    Hi Warren,
    We don't want our process to expire and also not to execute twice at once. We have a provisioning wrapper workflow which is triggered one time by an alert and it runs endlessly by creating an alert at the end of each instance triggering another instance of the same unless CPO hangs or goes to stand by mode. Since we belong to service team, we don't have any kind of access to CPO DB or logs, so that possibility is ruled out. Just checking for alternatives. 

  • Cron job help- Need to run the Autobuddy command every night...

    I have not written anything in the form of a Unix script for YEARS and YEARS. Our XServe was built in Advanced mode, currently running 10.5.4 Server. On this box, we are running Wiki and iChat. Since we built this box as an Advanced box the "Autobuddy" option was not available.
    I have since enabled it at the command line, but I am told by Apple that there still needs to be a command run after every time a user logs in if you want others to Autobuddy. That command is this:
    "sudo /usr/bin/jabber_autobuddy -m"
    Now I think this would be pretty easy to setup as an automatic cron script, but like I said, I have not written something like this in forever. Not to mention, I am not 100% sure what needs to happen since running the script with an sudo command will prompt for the root password.
    I was wondering if anyone would be able to help me write the script up, and give me some instructions on how to install it. I just want it run everyday, midnight is fine, I don't really care. All I know is that we have a dept of 150 people, and it grows and shrinks all the time. They can deal with a new user not being seen for 24-48 hours, I just want to get this automated.
    Any helps would be GREATLY appreciated!
    Thanks
    Tom

    If you want to keep it simple try [CronniX|http://www.abstracture.de/projects-en/cronnix] a graphical tool for setting up CRON jobs on OSX. Whilst I have not actually done an autobuuddy in this way, I cannot see any reason why it will not run as a Cron Job.
    The proper way ideally would be to use the launchd service.
    Something like this should work:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Label</key>
    <string>org.jabber.dailyautobuddy</string>
    <key>ProgramArguments</key>
    <array>
    <string>/usr/bin/jabber_autobuddy</string>
    <string>-m</string>
    </array>
    <key>LowPriorityIO</key>
    <true/>
    <key><UserName></key>
    <string>admin</string>
    <key>StartCalendarInterval</key>
    <dict>
    <key>Hour</key>
    <integer>0</integer>
    <key>Minute</key>
    <integer>05</integer>
    </dict>
    </dict>
    </plist>
    (not sure why, but tabs are not showing up, making this hard to read)
    Message was edited by: Tim Harris

  • Premiere Elements 8 and crashes

    Question:  I have tried all the Adobe recommended fixes due to my NVidia graphics card but my project still regularly crashes and now as soon as it starts loading the elements, it crashes with no error message.
    System:  Windows 7 Professional (x64) (build 7600)
                   2.80 gighertz Intel Core i7 860
                   Multi-core (4 total)
                   Hyper-threaded (8 total)
                   64-bit ready
                   32 kb primary memory cache
                   8192 kb secondary memory cache
                   999.99 Gig Usable Hard Drive
                   748.24 Gig free space
                   Main circuit Board Gigabyte Technology P55M-UD2
                   Bus Clock: 133 MH
                   Bios: Award Software International F11 06/23/2010
                   4 Gig Memory; 2 Gig each in Slot A0 and A2
                    Single ATA Hard Drive     WDC WEd002FAEX-00Z3A0
                  NVIDIA GeForce 8400 GS Display Adapter with newest 64 bit driver 266.58
    Assets:   About 300 still images imported from an album in Photoshop elements shot with a Cannon Power Shot a570 IS
                  Stills are at 3072 x 2304 or vice version, RGB, 180 resolution
                  27 short video clips from a Kodak Zi6 converted to avi files by AVS Video Converter
    Project:  I believe the presets are for NTSC DV although I can't get in to check; they've been this way because I usually shoot video with my Sony VX 2100.
    Workflow:  I imported the stills in chronological order preceding the first video.  Then more stills in chronological order before the next relevant video.  I am using the timeline.  After each import I save, add transitions (mostly the cross dissolve), save, and render.  Sometimes after saving rendered files, the system crashes and when I get back in the files haven't been rendered.
         Some vertical stills it accepts just fine.  For some others, I have to rotate them.
    What I have done:  I read all the suggestions from Adobe and the forums for dealing with the NVIDIA card.  This is what I have done in the approximate order I have done it:
         1. Installed the 8.0.1 update
         2. Updted the NVIDIA GeForce 8400 GS driver to the newest 64 bit driver 266.58.  I tried to do this update a couple of times.  The sytem kept telling me the 260 driver was current but the NVIDIA website said to use the 266.58.  I finally got it installed but a little later in the process.
         3. I could not disable the Hardware Acceleration as the NVIDIA card would not let me...the option was grayed out.
         4. I set both the global and the Premiere Elements threaded optimination to off.
         5. I turned off "Enable GPU playback" at one time when I could still get into the program.
         6. I recreated the adobe premiere elments plugincache.
         7. I uninstalled the Nvidia 3D Stereo driver...it was called Stereo not steroscopic.  In the NVIDIA control panel I did not install the Stereoscopic functions.
         8.  I was still crashing frequently. I was getting the low memory message, so I searched the forums and found directions to change the size of the paging file by clicking Start/accessories/run as administrator/enter at the command prompt BCDEDIT/SET INCREASEUSERVA ####.  I started with 3072 then gradually increased as it wasn't helping up to 8000.
         9. I think I finally upgraded the driver to the 266.58 at this point.
        10.  This morning I found directions on how to check the size of the paging file by accessing the control panel.  It showed my paging file was only 4096 (I guess the former advice didn't work) and it changed it to a virtual memory minimum of 8000 and a maximum of 10000.
         Now I can't get into the program at all.  It says it has loaded 100%, then there is a 100 second pause.  It starts loading the media and crashes.
    I love Adobe products and was a former Adobe Premiere 6.5 user. Premiere Elements as described is perfect for me as a video hobbyist.  Please help!  I would welcome any more suggestions that I can try.  Do you think I should just find a replacement for the NVidia board?  If so, what would you recommend.  I tend to do long projects.  I just can't live with all these crashes.
    Sincerely,
    Tracy Matern
    [email protected]

    Tracy,
    Great job with the details - very well done!
    This should be a "poster-child" for how to state details, and a problem.
    Now, first thing that I see, regarding the crashes are the size of your still images. Overly-large stills require a ton of resources, and can crash the program, and/or the computer. Scaling of the stills to near the Frame Size of the Project will help greatly, and actually improve the quality of the output. This ARTICLE will give you tips.
    Next, with a 64-bit OS, like Win7-64, 4GB of RAM is about the minimum for just the OS. Though PrE cannot use more than the 3.5GB of RAM, as it is still a 32-bit app., but the OS and other programs, certainly can. I would bump that up, if at all possible. Your OS and any other programs, will love you for it.
    Off the top of my head, it sounds like you have got the video sub-system well handled, and would look beyond it (for now), to other factors.
    You might want to see this ARTICLE on setting up a computer for video-editing sessions, and especially the link to Black Viper's Win7 Tune Up Tips Web site.
    Also, check that you have the latest version of Apple's QT Player.
    If necessary, there are more troubleshooting tips, and I'll be glad to share those, if necessary.
    Thanks for the great post, and good luck,
    Hunt

  • Adobe Premiere Pro CC 2014 keeps lagging and crashing

    My Adobe Premiere Pro CC 2014 keeps lagging and crashing to a point where I cannot do my job. When I open my premiere file, I can work on my timeline for maybe two or three minutes before it lags, freezes, and then finally crashes. I'm at a loss of what exactly is causing my problem because I edit primarily H.264 files and my sequences are not complex in any sense of the word. I've been dealing with this for days and I cannot seem to find a solution. If anyone has any advice please let me know because I am desperate. Thank you.
    Specs:
      Model Name: Mac Pro
      Model Identifier: MacPro6,1
      Processor Name: Quad-Core Intel Xeon E5
      Processor Speed: 3.7 GHz
      Number of Processors: 1
      Total Number of Cores: 4
      L2 Cache (per Core): 256 KB
      L3 Cache: 10 MB
      Memory: 16 GB
      Boot ROM Version: MP61.0116.B05
      SMC Version (system): 2.20f18
      Illumination Version: 1.4a6

    Hi Dana,
    Can you go to File-Project Settings-General and change the video renderer to Software Only Mode.
    Check if that works or not.
    Are you using any third party plug-in's for Premiere Pro?
    Thank You
    Arjun

  • Schedule rman using cron job

    I have scheduled a cron job to take rman backup of database everyday at 4PM. But I see that the empty backup.log file is getting generated while the script is not running. If I run the backup.sh script manually then the backup is running fine. The following are the scripts and the crontab details,
    backup.sh script is as follows,
    cd /u01/app/oracle/rmanbkp
    rman target / <<EOF
    run
    allocate channel ch1 type disk format '/u01/app/oracle/rmanbkp/%d_%T_%s.bak';
    backup database;
    delete noprompt obsolete;
    exit;
    EOF
    while the output of 'crontab -l' is
    00 16 * * * /home/imsoracle/backup.sh > backup.log
    Backup is not happening, what is wrong in my settings. Please advise.

    Dear $ami Malik,
    There is another option that you can use for RMAN scripting as shown below;
    0 2 * * 2 export ORACLE_HOME=/oracle/product/10.2.0/db_1/ ;
    /oracle/product/10.2.0/db_1/bin/rman cmdfile /db/optima/archive/OPTPROD/RMAN/backup_full.sh
    log /db/optima/archive/OPTPROD/RMAN/backup_full.log
    vals2:/home/oracle#cat /db/optima/archive/OPTPROD/RMAN/backup_full.sh
    connect target sys/password@optprod
    backup database format '/db/optima/archive/OPTPROD/backupset/DB_FULL_%d_%t_%s_%p';
    backup archivelog all delete all input format '/db/optima/archive/OPTPROD/backupset/ARC_%d_%t_%s';
    exit;So you can construct such backup strategy with the cmdfile and log options of the recovery manager.
    Hope That Helps.
    Ogan

  • How to Create Linux-Cron Job  from a Java Program

    Hello,
    Can anybody help me to CREATE/EDIT/DELETE Linux Cron job from Java Program. Its Very Urgent.Thanks in advance..
    from
    Chakri

    I decided this didn't sound too tough so I played around with it a little. Basically because I'd never tried executing external processes out of java before, so I wanted to see how it was done.
    Just change whatever you like in the jobs ArrayList and call writeJobs.
    If you call writeJobs without putting anything in the list first you'll wipe out all of your crontab entries.
    import java.lang.*;
    import java.io.*;
    import java.util.*;
    public class cron {
        ArrayList jobs;
        Runtime rt;
        cron() {
         rt = Runtime.getRuntime();
         jobs = new ArrayList();
        void readCron() {
         String[] list = { "crontab", "-l" };
         jobs = new ArrayList();
         try {
             // Stick a job into crontab
             Process child = rt.exec(list);
             BufferedReader cronout = new BufferedReader(new InputStreamReader(child.getInputStream()));
             String cronjob = cronout.readLine();
             while (cronjob != null) {
              jobs.add(cronjob);
              cronjob = cronout.readLine();
             child.waitFor();
         catch(IOException e) {
             System.err.println("IOException starting process!");
         catch(InterruptedException e) {
             System.err.println("Interrupted waiting for process!");
        void listJobs() {
         Iterator iter = jobs.iterator();
         while (iter.hasNext()) {
             System.out.println((String)iter.next());
        void writeJobs() {
         String[] edit = { "crontab"};
         try {
             // Stick a job into crontab
             Process child = rt.exec(edit);
             PrintWriter cronIn = new PrintWriter(child.getOutputStream());
             Iterator iter = jobs.iterator();
             while (iter.hasNext()) {
              cronIn.println((String)iter.next());
             cronIn.close();
             child.waitFor();
         catch(IOException e) {
             System.err.println("IOException starting process!");
         catch(InterruptedException e) {
             System.err.println("Interrupted waiting for process!");
        void doStuff() {
         readCron();
         listJobs();
         jobs.add("* * * * 4 cronjob");
         writeJobs();
         readCron();
         listJobs();
        public static void main(String[] args) {
         cron c = new cron();
         c.doStuff();
    }

Maybe you are looking for

  • Firefox 3.6.3 is not supported by the Google Font API

    I have Firefox 3.6.3 on my Macbook, but is only detected as 3.0.1on this form. When I link to the Google font website, it says, "We're sorry, but your browser is not supported by the Google Font API. To browse the fonts in the Google font directory p

  • ECC6 - Line item display and Open item management Questions.

    Hi All, For SAP ECC6, although I do not maintain line item display and open item management for Recon GL (for Debtor), I still can use FAGLB03 to view the GL balances and even Drill down to line item level by double click the value from FAGLB03 until

  • Itunes opening twice

    When I open itunes, it opens two pages each time. The normal music page, and the app page. Closing either closes both.

  • How to change Label Color Dinamically

    Hallo, i have a Label: <s:Label id="fotoAssociata_nuostr" text="Foto Non Associata" left="512" top="138" color="RED"/> The color is RED and i want to change it dinamically through ActionScript but when i call this.fotoAssociata_nuostr, i can't find c

  • FIM "failed while calling the BPC system"

    Hi guys. Hope there's an FIM wizard out there. We have FIM installed on our BPC server (BPC 7.5 SP06 & FIM 7.5 SP08) I am seeing an issue with the connection manager in FIM: When I create a new connection, it seems to form correctly (resolves name/IP