EJB Persistence using cron job

We have a EJB based bean managed persistence classes that run on the app server. I want to use same classes using cron job.
How do I do that???
Tried to execute these classes thru following steps...
In side stand alone java class - main method create instance of the pmf and get persistence manager.
Start a tread and call JDO object using persistence manager.
getting whole bunch or errors like system-server-config.xml file not found. I am not able to create InitialContext outside app server.
Please give your suggestions. TIA

Why don't you use a J2EE based scheduler?
http://java-source.net/open-source/job-schedulers/quartz
http://java-source.net/open-source/job-schedulers/jcrontab

Similar Messages

  • Using cron-job to call the PL/SQL procedure for every 5 min

    Hi All,
    i wrote one procedure. using cron-job to call this PL/SQL procedure for every 5 min. i don't have any idea about cron job & what is thescript file formate .where can i place that script file. what are the details we placed in that script

    Really appreciate you. I like this approach .
    please give me advice for the below thing
    job_action =>an i give my procedure name under this?
    BEGIN
    -- Job defined entirely by the CREATE JOB procedure.
    DBMS_SCHEDULER.create_job (
    job_name => 'Job_schedule_update',
    job_type => 'PLSQL_BLOCK',
    job_action => 'BEGIN Schedule_update; END;',
    start_date => SYSTIMESTAMP,
    repeat_interval => 'FREQ=HOURLY;BYMINUTE=5',
    end_date => NULL,
    enabled => TRUE,
    comments => 'Job defined entirely by the CREATE JOB procedure.');
    END;

  • 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

  • Running Applescript using cron jobs not working

    I'm new to conjobs and applescript but I have the script done correctly i believe. (any critique is welcome) I don't want to bloat my calendar with events to do this because I use my calendar for appointments and I don't need the bloat.
    Here's my goal: run an apple script at 9am/5pm to enable/disable a mail account (after this works I'm going to add loging in/out of an Messenger account, first things first)
    here's my script:
    tell application "Mail"
              set offTime to 17
              set onTime to 9
              set dayOfWeek to weekday of (current date)
              set theHour to get the (hours of (current date)) as string
              if theHour ≥ onTime then
                        say "email on"
                        set enabled of account "MAILBOX" to true
              else if theHour ≥ offTime or (dayOfWeek = Saturday or dayOfWeek = Sunday) then
                        say "email Off"
                        set enabled of account "MAILBOX" to false
              end if
    end tell
    accessing cron jobs via this
    sudo pico /etc/crontab 
    and within cron jobs i've used
    0 9 * * * username osacript
    "/Documents/disablemail.scpt"
    0 17 * * * username osacript
    "/Documents/disablemail.scpt"
    variations I've attempted (based on search engine results)
    0 9 * * * username osacript
    "~/Documents/disablemail.scpt"
    0 9 * * * /Documents/disablemail.scpt
    0 9 * * * ~/Documents/disablemail.scpt
    0 9 * * * osacript /Documents/disablemail.scpt
    0 9 * * * osacript ~/Documents/disablemail.scpt
    I think that's all of them.
    Any feedback/assitance appreciated, thanks!

    What's the problem, is the cronjob not getting called at all or is the script giving errors?
    One problem you have right off is the cron job you have set up is running as root not as you.

  • Schedule export using cron?

    Hi
    I want to schedule the export of a table using cron job.
    create the .sh file as below
    export ORACLE_BASE=/opt/oracle
    export ORACLE_HOME=/opt/oracle/product/9.2.6/db_1
    export ORACLE_SID=orcl
    /opt/oracle/product/9.2.6/db_1/bin/exp system/manager file=/home/oracle/test.dmp log=/home/oracle/test.log tables=table_name
    $crontab -l
    43 16 * * * /home/oracle/export.sh > /home/oracle/export.log
    but when this crontab job runs export is not performed and i can't file the export dump file and logile.
    test.log file is getting created with nothing in it.
    Can any one let me know what is wrong with the shell script.
    Regards,

    Hi ,
    Can you please change the permission of your export.sh file
    $chmod 775 export.sh.
    Study the below link for more details.
    http://www.elated.com/articles/understanding-permissions/
    Best regards,
    Rafi.
    http://rafioracledba.blogspot.com/

  • 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!).

  • 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.

  • 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

  • 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

  • Need advice on running timer based cron jobs

    Hi,
    We made a cool desktop product on Flex that runs on the Air environment. After having released it a while ago, we think about taking its performance to the next level by being able to mimic cron job like functionality based on timers.
    However, one of the setbacks for us while we tried to do something similar earlier was the Flash platform's single threaded architecture. So if we are running something resource consuming in the background, chances are that the UI might get stuck if a part of it is being rendered. That will make things looks ugly and we are trying to find ways to make it work.
    Can anyone recommend anything that would help?
    Thanks!
    Vivek

    > 1. What is the best fastest system AE can take advantage of? If we get 6 or 8 or 12 core Mac Pros (instead of the quad core) with more RAM, would AE be able to access that speed, and if so up to how many GB can it use, only up to 2GB per core or can it use more?
    Yes, After Effects will take advantage of multiple fast CPUs and all of the RAM that you can install.
    You also want to have a decent-sized SSD connected over a fast bus for the disk cache. The new Mac Pro does very well in that regard.
    2. Should we replace the graphics card with an Nvidia CUDA? Is the ray-tracing engine something we’ll need with Cinema 4D work?
    The After Effects ray-traced 3D renderer has nothing whatsoever to do with Cinema 4D.
    Do not make any buying decisions based on the  After Effects ray-traced 3D renderer unless you already know for certain that you have a need for it. Since you're asking, it seems that the answer is that you don't.
    See this page for information about hardware for Premiere Pro and After Effects: http://adobe.ly/pRYOuk

  • Mount USB/Firewire drive from shell or cron job

    Is there a way to mount a USB/Firewire drive from the shell or possibly mount it using a cron job? Here's the situation. I have a user that keeps all of her data on her desktop or in her Documents folder. I have attached a firewire drive to her PowerMac G5 (OS 10.4.6) and successfully created cron jobs to backup her entire user folder every night. The problem is that she logs off of her computer before she leaves work. When she logs of the firewire drive unmounts and the cron job fails because it cannot find the drive. I was hoping there was a way to mount the drive using a script so that it will mount, let the cron job run, and then possibly unmount the drive afterwards. Any help with this would be much appreciated.
    MacMini, PowerMac G5, iMac   Mac OS X (10.4.7)  

    Try adding the following line to the beginning of the job:
    mount -a
    You may need to add u and/or w to the command after the a without any additional spaces for the mount to work properly.
    (13951)

  • DBA scripts run by cron job

    We've got a development database on which we're working every day. We intend to set up a cron job to run about once a week to help in the maintainance & performance of the database.... analyzing tables, stuff like that. Does anybody have any suggestions as to what scripts it's useful to run to help keep things running smoothly?
    We're using 9.0.1
    Cheers
    RT

    We've got a development database on which we're working every day. We intend to set up a cron job to run about once a week to help in the maintainance & performance of the database.... analyzing tables, stuff like that. Does anybody have any suggestions as to what scripts it's useful to run to help keep things running smoothly?
    We're using 9.0.1
    Cheers
    RT i'd suggest you try out oracle enterprise manager and look at the list of events you can test for. You can use this list to implement in cron or let OEM do it for you. You'll find test like, is the listener up, is the db up, is the server up, what tablespaces will not be able to extend, if a disk is getting fulletc and stuff like that . Those items should help you frame your scripts for cron if you like.

  • Fail to save a Cron job (SOLVED)

    I can't save a new cron job in my system. I use
    crontab -e
    or
    export VISUAL=gedit && crontab -e
    to add a new job. These commands open a /tmp/crontab.XXXX file that after saving, cron jobs are NOT updated!
    It's too strange to me* !
    I run
    nano -w /var/spool/cron/root
    and the cron job is listed now by
    crontab -l
    Why I can't save cron jobs directly from crontab -e?
    ( I have read the vi man pages :-) )
    * I am newbie, just one month Linux user with 3 distro succesfully installed

    osigen wrote:Ooops! VI is complicated editor.
    Thanks anyway!
    Its a great editor once you learn to use it 
    here's some usesfull documentation on the commands:
    http://www.fprintf.net/vimCheatSheet.html

  • 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

Maybe you are looking for