Cron Job to start SunOne WebServer

Hello,
I installed the SunOne Webserver in Linux AS 4 as OS level. I try to create a cron job to stop and start the WebSever every night. The stop is quite simple to create a cron job. However, the start script is a bit tricky since I will have to key in the Token (password) as I manual start the script. How do I create a cron job to start the Web Server like this?
I used the Web server to do datatel's webadvisor. I just don't know how to configure the SunOne Web Server 6.1 (SP5) to the best interface with webadvisor. Does any one have this kind of experience please share with me?
Your thought would be greatly appreciated!!!!

mle wrote:
Hello,
I installed the SunOne Webserver in Linux AS 4 as OS level. I try to create a cron job to stop and start the WebSever every night. Why on earth would you want to do that? This is Linux, not Windows.
My guess is that you have memory leaks that benefit from a bounce to set the clock back to zero on a daily basis.
My advice would be to fix the leaks and don't bounce the server that way.
If the leaks originate with the app server, get one that doesn't leak.
Does any one have this kind of experience please share with me?Sounds like a very bad idea. I'd fix the root problem first.
%

Similar Messages

  • Cron job to start machine.

    Is there a way to get the machine to start, open iTunes and start playing a song at a specified time using a cron job?
    MacBook Pro 15.4" - Intel Core Duo 2.0   Mac OS X (10.4.6)   2GB RAM

    I have my computer do exactly what you want yours to do, except I don't use a cron job. In case you don't actually need to use cron, I'll tell how I get it to happen.
    As mentioned by Federico_82, I use the Energy Saver preferences in System Preferences. There is an "Schedule..." button in the lower right corner that will allow you set the startup and/or shutdown times for the computer. It's not very detailed, but it suits my purposes for waking up Monday through Friday.
    I also have the computer automatically log me in using the Login Options in Accounts preferences in System Preferences.
    Finally, I've set alarms in iCal and chose "Open file" in the alarm section of the Info drawer. You can select a song file (or anything really) to be opened and the song will be played with iTunes since songs should automatically open with iTunes.
    I've also set the final option in the alarm section to perform this 5 minutes before the time I set for the event, with the event time being the same time as the computer startup. This is okay because it will perform an alarm that was suppose to happen even if it couldn't do it earlier, for example because the computer was off. So you don't have to worry about timing it perfectly. Just set the alarm time to the same as the startup time for the computer or earlier if you want it to happen immediately upon startup, then the alarm will go off immediately after computer turns on and logs you in.
    Also keep in mind you can set the event to repeat at various intervals in iCal, such as Monday through Friday or various discontinuous days of the week every week, and so on. Very customizable.
    Personally, I use an Automator app to start playing a playlist in iTunes, and to set the iTunes volume to an appropriate level to wake up with just in case I've change the volume the last time I used iTunes. In this way, I can simply change the song in the playlist in iTunes without having change the alarm event in iCal. This helps because then I can copy/paste the alarm anywhere I want and don't have to worry about finding another song file if I want to change the song. Instead, I simply find the song I want in iTunes and put it in the playlist, along with any other songs I want have played.
    If you do it with an Automator workflow, simply save the workflow as an iCal Alarm with "Save As Plug-in...". It'll automatically save in your ~/Library/Workflows/Applications/iCal folder, without you having to figure that out. Oh, and it doesn't hurt to test the workflow to make sure it plays your playlist (or whatever you have it do) before saving it as an iCal Alarm. Though, you can re-edit later if you want.
    Once you've saved your workflow as an iCal Alarm, it'll show up in list of files to open in the alarm section for the event. So, after you've chosen "Open file" in that section, the default for the file will be "iCal", but you'll also be able to choose any iCal alarms you've saved in Automator or any other file (such as a document or a song).
    Just as a bit of trivia, a plug-in you save in Automator is actually the same thing as saving your workflow as an application. The only difference is that the app is saved to a specific location so the Finder, or iCal, or Image Capture, etc., can find it. So, you don't have to know where to save it, Automator does that for you, but I told you where it is anyways (though you could use Spotlight) so you can get to it to edit it again if you want. Just drag and drop the app onto Automator or open it from within Automator to edit it again.
    I hope that helps. Though it might sound kind of complicated at first, I think this way is much easier than dealing with a crontab and trying to synchronize it with startup and so on. You'll also find this way very customizable with the various options for iCal alarms and the many possibilities with Automator (if you choose to use a workflow instead of simply a song file).

  • [SOLVED] Cron Job that starts every 30 minutes from boot

    I wish to have a cron job that runs a script every 30 minutes from boot, without any users logging in.
    I know about crontab -e, but I think that would I only run once i'm logged in. I've also heard about @reboot, but that would only run the script once.
    RabbidRabbit
    Last edited by rabbidrabbit (2012-01-31 20:14:13)

    Cron jobs will run whenever the system is up, regardless of whether or not anyone is logged in.
    I don't remember the syntax, but I know that at least some cron implementations have a way to run a job every 30 minutes, starting for the first time 30 minutes after reboot.
    EDIT: I just checked the syntax for fcron, which is what I use, and it seems like doing @ 30 your/command/here will make it run every 30 minutes of uptime.
    Last edited by kyla (2012-01-31 00:17:30)

  • Problem starting the sunone webserver 6.1 sp4

    Hi,
    I am facing problem with starting sunone webserver 6.1 sp4.
    Server is starting fine on one of the IPs configured on the box but not starting on other IPs although these IPs are pingable.I assign port nos.
    I am getting following logs.
    Server Start Up
    Status:
    *[https-test]: start failed. (0: SSL_ERROR_NO_CERTIFICATE: unable to find the certificate or key necessary for authentication)*
    *[https-test]: Sun ONE Web Server 6.1SP4 B01/20/2005 17:43*
    *[https-test]: fine: Emulating writev for filter http-compression*
    *[https-test]: fine: Emulating sendfile for filter http-compression*
    *[https-test]: fine: HTTP3063: KeepAliveTimeout is 30 seconds (default value)*
    *[https-test]: fine: HTTP3067: PostThreadsEarly set to off*
    *[https-test]: fine: createAdminChannel()*
    *[https-test]: fine: CORE3047: Server spawned worker process 25518*
    *[https-test]: fine: HTTP5169: User authentication cache entries expire in 120 seconds.*
    *[https-test]: fine: HTTP5170: User authentication cache holds 200 users*
    *[https-test]: fine: HTTP5171: Up to 4 groups are cached for each cached user.*
    *[https-test]: info: CORE3016: daemon is running as super-user*
    *[https-test]: fine: HTTP4207: file cache module initialized (API versions 1 through 1)*
    *[https-test]: fine: HTTP4302: file cache has been initialized*
    *[https-test]: fine: HTTP3066: MaxKeepAliveConnections set to 256*
    *[https-test]: warning: CORE1251: On group ls1, servername test does not match subject "login.secure.com" of certificate Server-Cert.*
    *[https-test]: warning: CORE1250: In secure virtual server https-test, urlhost test does not match subject "login.secure.com" of certificate Server-Cert.*
    *[https-test]: fine: Installed configuration 1*
    *[https-test]: fine: jvm stickyAttach: 1*
    *[https-test]: fine: jvm option: -DJAVA_HOME=/opt/software/sunone/bin/https/jdk*
    *[https-test]: fine: jvm option: -Dcom.sun.web.installRoot=/opt/software/sunone*
    *[https-test]: fine: jvm option: -Dcom.sun.web.instanceRoot=/opt/software/sunone*
    *[https-test]: fine: jvm option: exit*
    *[https-test]: fine: jvm option: vfprintf*
    *[https-test]: fine: jvm option: -Djava.security.auth.login.config=/opt/software/sunone/https-test/config/login.conf*
    *[https-test]: fine: jvm option: -Djava.util.logging.manager=com.iplanet.ias.server.logging.ServerLogManager*
    *[https-test]: fine: jvm option: -Xmx256m*
    *[https-test]: fine: jvm option: -Djava.class.path=/opt/software/sunone/bin/https/jar/webserv-rt.jar:/opt/software/sunone/bin/https/jdk/lib/tools.jar:/opt/software/sunone/bin/https/jar/webserv-ext.jar:/opt/software/sunone/bin/https/jar/webserv-jstl.jar:/opt/software/sunone/bin/https/jar/ktsearch.jar::*
    *[https-test]: fine: Emulating writev for filter j2ee-filter*
    *[https-test]: fine: Emulating sendfile for filter j2ee-filter*
    *[https-test]: fine: reinitializeLogger: javax.enterprise.system.core com.sun.logging.enterprise.system.core.LogStrings FINEST*
    *[https-test]: fine: reinitializeLogger: null FINEST*
    *[https-test]: fine: reinitializeLogger: global null FINEST*
    *[https-test]: fine: reinitializeLogger: javax.enterprise.system.util com.sun.logging.enterprise.system.util.LogStrings FINEST*
    *[https-test]: fine: reinitializeLogger: javax.enterprise.system.core.config com.sun.logging.enterprise.system.core.config.LogStrings FINEST*
    *[https-test]: info: CORE5076: Using [Java HotSpot(TM) Server VM, Version 1.4.2_04] from [Sun Microsystems Inc.]*
    *[https-test]: fine: initializeServerLogger: javax.enterprise.system.core.classloading com.sun.logging.enterprise.system.core.classloading.LogStrings FINEST*
    *[https-test]: fine: initializeServerLogger: javax.enterprise.system.container.web com.sun.logging.enterprise.system.container.web.LogStrings FINEST*
    *[https-test]: fine: WEB7101: Naming Service has been successfully initialized.*
    *[https-test]: fine: initializeServerLogger: javax.enterprise.resource com.sun.logging.enterprise.resource.LogStrings FINEST*
    *[https-test]: fine: WEB7010: Resource Manager has been successfully initialized.*
    *[https-test]: fine: initializeServerLogger: javax.enterprise.system.core.security com.sun.logging.enterprise.system.core.security.LogStrings FINEST*
    *[https-test]: fine: Initializing configured realms.*
    *[https-test]: fine: FileRealm : file=/opt/software/sunone/https-test/config/keyfile*
    *[https-test]: fine: FileRealm : jaas-context=fileRealm*
    *[https-test]: fine: Reading file realm: /opt/software/sunone/https-test/config/keyfile*
    *[https-test]: fine: Configured realm: file*
    *[https-test]: fine: NativeRealm: auth-db= null (will use default)*
    *[https-test]: fine: NativeRealm : jaas-context=nativeRealm*
    *[https-test]: fine: Configured realm: native*
    *[https-test]: fine: LDAPRealm : directory=ldap://localhost:389*
    *[https-test]: fine: LDAPRealm : base-dn=o=isp*
    *[https-test]: fine: LDAPRealm : jndiCtxFactory=com.sun.jndi.ldap.LdapCtxFactory*
    *[https-test]: fine: LDAPRealm : jaas-context=ldapRealm*
    *[https-test]: fine: LDAPRealm : mode=find-bind*
    *[https-test]: fine: LDAPRealm : search-filter=uid=%s*
    *[https-test]: fine: LDAPRealm : group-base-dn=o=isp*
    *[https-test]: fine: LDAPRealm : group-search-filter=uniquemember=%d*
    *[https-test]: fine: LDAPRealm : group-target=cn*
    *[https-test]: fine: LDAPRealm : search-bind-dn=null*
    *[https-test]: fine: LDAPRealm : search-bind-password=null*
    *[https-test]: fine: LDAPRealm : pool-size=5*
    *[https-test]: fine: LDAPRealm : authentication=simple*
    *[https-test]: fine: Configured realm: ldap*
    *[https-test]: finest: Realm: getInstance returning realm :native*
    *[https-test]: fine: Default realm is set to: native*
    *[https-test]: fine: Application server configuration file: /opt/software/sunone/https-test/config/server.xml*
    *[https-test]: fine: Application Server default locale is en*
    *[https-test]: fine: Web container log level: FINEST*
    *[https-test]: finer: Creating engine*
    *[https-test]: finer: Adding engine (org.apache.catalina.core.StandardEngine/1.0)*
    *[https-test]: info: WEB0100: Loading web module in virtual server [https-test] at [search]*
    *[https-test]: finer: Creating Loader with parent class loader 'sun.misc.Launcher$AppClassLoader@67ac19'*
    *[https-test]: fine: WebModule[search]: Setting delegate to false*
    *[https-test]: fine: Default role is: ANYONE*
    *[https-test]: fine: WEB0100: Loading web module in virtual server [https-test] at []*
    *[https-test]: finer: Creating Loader with parent class loader 'sun.misc.Launcher$AppClassLoader@67ac19'*
    *[https-test]: fine: WebModule[]: Setting delegate to false*
    *[https-test]: fine: Successfully initialized web application environment for virtual server [https-test]*
    *[https-test]: finer: Starting embedded server*
    *[https-test]: finer: Naming prefixes property is set to: org.apache.naming*
    *[https-test]: finer: Naming initial context factory property is set to: org.apache.naming.java.javaURLContextFactory*
    *[https-test]: finer: WebModule[search]: Starting*
    *[https-test]: finer: WebModule[search]: Processing start(), current available=false*
    *[https-test]: finer: WebModule[search]: Configuring default Resources*
    *[https-test]: finer: WebModule[search]: Processing standard container startup*
    *[https-test]: finer: WebappLoader[search]: WEB3106: Deploying class repositories to work directory /opt/software/sunone/https-test/ClassCache/https-test/search*
    *[https-test]: finer: WebappLoader[search]: WEB3107: Deploy JAR /WEB-INF/lib/messages.jar to /opt/software/sunone/bin/https/webapps/search/WEB-INF/lib/messages.jar*
    *[https-test]: finer: StandardManager[search]: WEB3421: Seeding random number generator class java.security.SecureRandom*
    *[https-test]: finer: StandardManager[search]: WEB3417: Seeding of random number generator has been completed*
    *[https-test]: finer: ContextConfig[search]: WEB3539: ContextConfig: Processing START*
    *[https-test]: finer: WebModule[search]: Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'*
    *[https-test]: finer: WebModule[search]: Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'*
    *[https-test]: finer: ContextConfig[search]: Scanning web.xml tag libraries*
    *[https-test]: finer: ContextConfig[search]: URI='/search', ResourcePath='/WEB-INF/sun-web-search.tld'*
    *[https-test]: finer: ContextConfig[search]: tldConfigJar(/WEB-INF/sun-web-search.tld): java.util.zip.ZipException: error in opening zip file*
    *[https-test]: finer: ContextConfig[search]: URI='/jstl-fmt', ResourcePath='/WEB-INF/fmt.tld'*
    *[https-test]: finer: ContextConfig[search]: tldConfigJar(/WEB-INF/fmt.tld): java.util.zip.ZipException: error in opening zip file*
    *[https-test]: finer: ContextConfig[search]: Scanning library JAR files*
    *[https-test]: finest: Realm name has been set to: native*
    *[https-test]: finest: Realm: getInstance returning realm :native*
    *[https-test]: finest: The realm native is a NativeRealm.*
    *[https-test]: finer: ContextConfig[search]: Pipeline Configuration:*
    *[https-test]: finer: ContextConfig[search]: org.apache.catalina.core.StandardContextValve/1.0*
    *[https-test]: finer: ContextConfig[search]: ======================*
    *[https-test]: finer: WebModule[search]: Configuring application event listeners*
    *[https-test]: finer: WebModule[search]: Sending application start events*
    *[https-test]: finer: WebModule[search]: Starting filters*
    *[https-test]: finer: WebModule[search]: Posting standard context attributes*
    *[https-test]: finer: StandardWrapper[search:invoker]: WEB2770: Loading container servlet invoker*
    *[https-test]: info: WEB2798: [search] ServletContext.log(): WEB3946: Parent class loader is: WebappClassLoader*
    *[https-test]: available:*
    *[https-test]: delegate: false*
    *[https-test]: repositories:*
    *[https-test]: required:*
    *[https-test]: ----------> Parent Classloader:*
    *[https-test]: sun.misc.Launcher$AppClassLoader@67ac19*
    *[https-test]:*
    *[https-test]: info: WEB2798: [search] ServletContext.log(): WEB3945: Scratch dir for the JSP engine is: /opt/software/sunone/https-test/ClassCache/https-test/search*
    *[https-test]: info: WEB2798: [search] ServletContext.log(): WEB3947: IMPORTANT: Do not modify the generated servlets*
    *[https-test]: finer: WebModule[search]: Starting completed*
    *[https-test]: finer: WebModule[]: Starting*
    *[https-test]: finer: WebModule[]: Processing start(), current available=false*
    *[https-test]: finer: WebModule[]: Configuring default Resources*
    *[https-test]: finer: WebModule[]: Processing standard container startup*
    *[https-test]: finer: WebappLoader[]: WEB3106: Deploying class repositories to work directory /opt/software/sunone/https-test/ClassCache/https-test/default-webapp*
    *[https-test]: finer: StandardManager[]: WEB3421: Seeding random number generator class java.security.SecureRandom*
    *[https-test]: finer: StandardManager[]: WEB3417: Seeding of random number generator has been completed*
    *[https-test]: finer: ContextConfig[]: WEB3539: ContextConfig: Processing START*
    *[https-test]: finer: WebModule[]: Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN'*
    *[https-test]: finer: ContextConfig[]: WEB3523: Missing application web.xml, using defaults only*
    *[https-test]: finer: ContextConfig[]: Scanning web.xml tag libraries*
    *[https-test]: finer: ContextConfig[]: Scanning library JAR files*
    *[https-test]: finest: Realm name has been set to: native*
    *[https-test]: finest: Realm: getInstance returning realm :native*
    *[https-test]: finest: The realm native is a NativeRealm.*
    *[https-test]: finer: ContextConfig[]: Pipeline Configuration:*
    *[https-test]: finer: ContextConfig[]: org.apache.catalina.core.StandardContextValve/1.0*
    *[https-test]: finer: ContextConfig[]: ======================*
    *[https-test]: finer: WebModule[]: Configuring application event listeners*
    *[https-test]: finer: WebModule[]: Sending application start events*
    *[https-test]: finer: WebModule[]: Starting filters*
    *[https-test]: finer: WebModule[]: Posting standard context attributes*
    *[https-test]: finer: StandardWrapper[:invoker]: WEB2770: Loading container servlet invoker*
    *[https-test]: info: WEB2798: [] ServletContext.log(): WEB3946: Parent class loader is: WebappClassLoader*
    *[https-test]: available:*
    *[https-test]: delegate: false*
    *[https-test]: repositories:*
    *[https-test]: required:*
    *[https-test]: ----------> Parent Classloader:*
    *[https-test]: sun.misc.Launcher$AppClassLoader@67ac19*
    *[https-test]:*
    *[https-test]: finer: WebModule[]: Starting completed*
    *[https-test]: fine: Adding web module : context = /search, location = /opt/software/sunone/bin/https/webapps/search*
    *[https-test]: fine: adding pattern "/advanced" for resource "AdvSearchServlet"*
    *[https-test]: fine: adding pattern "/servlet/*" for resource "invoker"*
    *[https-test]: fine: adding pattern "*.jsp" for resource "jsp"*
    *[https-test]: fine: Adding web module : context = , location = /opt/software/sunone/docs*
    *[https-test]: fine: adding pattern "*.jsp" for resource "jsp"*
    *[https-test]: fine: adding pattern "/servlet/*" for resource "invoker"*
    *[https-test]: fine: Waiting until the server is ready*
    *[https-test]: startup failure: could not bind to 172.26.51.90:443 (Cannot assign requested address)*
    *[https-test]: failure: HTTP3127: [LS ls1] https://172.26.51.90:443: Error creating socket (Cannot assign requested address)*
    *[https-test]: failure: HTTP3094: 1 listen sockets could not be created*
    *[https-test]: failure: CORE3186: Failed to set configuration*
    *[https-test]: failure: server initialization failed*
    Please suggest/help.
    Regards,
    Ashfaque

    The error message "Cannot assign requested address" means exactly that: Web Server has been configured to listen for requests on an IP address for which your operating system is not configured. You can a) change your Web Server configuration so it listens on 0.0.0.0 (meaning all configured IP addresses), b) change your Web Server configuration so it listens on a specific IP address for which your operating system is configured, or c) configure your operating system for IP address 172.26.51.90.
    The problem is not related to certificates or ports.

  • Starting stoping cron job

    How we can tell which cron jobs are running and how to start/stop them, give me example/command plz

    I do not know of any articles off the top of my head, but just remember if you can create a non-interactive script to do the job then you can run it as a cron job.
    Here are several types of cron jobs that we currently use:
    1. Kick off nightly hot and weekly cold backups.
    2. Gather statistics weekly (on just some databases)
    3. Gather performance statistics (perfstat) when wanted.
    4. Perform audit gathering/deletion jobs.
    5. Check for errors in alert logs and trace files and send out emails if needed.
    6. Check status of listeners and database processes to assure they are still running.
    7. Move log files to archiving storage
    We are going to eventually move a lot of these jobs to OEM Grid Control but until then cron is great.
    Regards
    Tim

  • 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

  • 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();
    }

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

  • CRON job on mac

    Hello,
    Not quite the right category for this but don't think the answer would be found in the non server forum.
    I would like to schedule a CRON job on 10.5 (not server), done it in older version, either I can't remember or it's changed... doesn OSX have crontab?
    Every 1 minute I want to call a php function on a webserver (which doesn't allow CRON)....
    m

    Hi
    On OSX Client its in /usr/lib. You should see an alias for cron and within that should be what you want. However you might be able to achieve what you want with launchd and its utility launchctl? Consult the manual pages for usage.
    There is a specific Terminal and Command Line Forum over on the 10.4 Server Forum:
    http://discussions.apple.com/forum.jspa?forumID=701
    You could check this forum out as it does focus on the command line and applescript amongst other things:
    http://discussions.apple.com/category.jspa?categoryID=162
    Tony

  • 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

  • Issue with WebPass for Sunone webserver.

    Hi,
    I installed sunone web server 6.1 and OAM WebPass for Sunone webserver. When i installed sunone webserver and started the same it worked fine but after installing webpass for sunone webserver and when i try to start webserver i am getting the following error:
    Server Start Up
    Status:
    [https-aldggni.dummy.com.]: start failed. (0: Error 0)
    [https-aldggni.dummy.com.]: Sun ONE Web Server 6.1SP10 (64-Bit) B09/04/2008 12:11
    [https-aldggni.dummy.com.]: failure: CORE3170: Configuration initialization failed: Error running init function load-modules: dlopen of /exaccess08/home/oracle/OAM/Webcomponent/identity/oblix/lib/libgcc_s.so.1 failed (ld.so.1: webservd: fatal: /exaccess08/home/oracle/OAM/Webcomponent/identity/oblix/lib/libgcc_s.so.1: wrong ELF class: ELFCLASS32)
    [https-aldggni.dummy.com.]: failure: server initialization failed
    Error
    An error occurred during startup.
    The server https-aldggni.dummy.com. was not started.
    THis complete installation is on Solaris Sprac 10. Any help on this is highly appreciated.
    Thanks

    The webpass requires a 32-bit version of SunOne WebServer.
    The certification matrix shows the supported platforms-
    http://www.oracle.com/technology/software/products/ias/files/idm_certification_101401.html#BABGCCGA

  • Cron job help

    hya m8s!
    so i want to create a cron job that will do the following in order.
    1.  run pacman -Syu
    2.  run pacman -Scc
    3.  run lilo (incase of kernel upgrade)
    i want this to run every day at 5am,
    the problem is that i know what i want it to do i just have NO idea how to implement it.  i have researched cron jobs a bit but i havent found an easy to understand way exec the above commands.  one of my m8s suggested i use the "at" command but i dont think i can set that to run at a specified time every day.  Please help if you can.
    cheers,
      cdk
    (note: once ifigure out cron i want to start to try to figure out how to build packages. i have also read the wiki on this and still dont get it)

    cdk wrote:
    why is it a bad thing to do?  seems like it would be a good thing so it keeps the system up to date right?
    i figure that if i do it manually or not i still doing the same thing everyday.  any info as to why this would be bad would be great.  i def dont want to mess up my system.
    Take KDE 3.3 to KDE 3.4 upgrade as an example:
    Your way would have just updated KDE without considering possible side-effects. The recommended way in this case was removal prior to upgrade.
    You would not have been able to follow those recommendations if a script would have done the job.
    If you really feel the need to auto-upgrade everyday, I'd recommend excluding problematic packages (e.g. kernel. IMO that should only be upgraded with the user watching) and keeping that list up to date by checking with the ARCH news and boards...
    greez
    bernhard

  • Cron job emCCR after installed OBI11.1.1.5.0

    OBIEE 11.1.1.5.0 on Rdhat 5.2. After installation saw a cron job created0,15,30,45 * * * * ORACLE_CONFIG_HOME=/u01/app/obi11115/instances/obi11_dev /u01/app/obi11115/Oracle_BI1/ccr/bin/emCCR -cron -silent start emCCR appears to be Configuration Manager. But do I have a Configuration Manager running for a default installation of OBI 11.1.1.5.0 Enterprise? If not does it has impact on my OBIE11
    Thanks

    A restart solved the issue.

  • 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

Maybe you are looking for