Cron job

Hi guys,.

I rose my whole environment up and running, I can manually create backups with ghettoVCBg2.pl and it works perfectly.

The only thing I want to do now, is to do a cron job.

I tested the function cron with the addition of a simple task in/etc/crontab:

* / 1 * root wall test

It works very well, every minute, I get the message 'test' in my console.

I can also add this to/etc/crontab:

* / 1 * root /home/vi-admin/test.sh

I made the file test.sh, it is what is in the file:

test wall

still, I get the message 'test' in my console.

Now the problem...

When I edit/etc/crontab with this:

* / 1 * root /home/vi-admin/ghettoVCBg2.pl--vmlist nag001 - dryrun 1

Nothing runs, I als tried to put the nag001 commande./ghettoVCBg2.pl--vmlist - dryrun 1 into a file called test.sh... after that I have edited/etc/crontab with:

* / 1 * root /home/vi-admin/test.sh

Yet once, nothing does.

When I look at "sudo nano/etc/crontab" I see:

crond [12611]: module: pam_lsass (root) CMD (/ home/vi-admin/test/sh)

crond [12611]: module: pam_lsass pam_sm_acct_mgmt doesn't have a login: root error code: 2

crond [12611]: module: pam_lsass pam_sm_close_session error error code: 2

BTW: I also tried to modify/etc/crontab with:

* / 1 * /home/vi-admin/test.sh vi-admin

and

* / 1 * vi - admin /home/vi-admin/ghettoVCBg2.sh vmlist - nag001 - dryrun 1

I have more knowledge here...

TNX in advance

Jim

Apparently, I could repeat the problem and solve it

Change backup.sh (script from cron for) in the following way

#!/bin/bash
#
LD_LIBRARY_PATH=/opt/vmware/vma/lib64:/opt/vmware/vma/lib
export LD_LIBRARY_PATH
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/java/jre-vmware/bin:/sbin:/usr/sbin:/home/vi-admin/bin
export PATH
cd /home/vi-admin/
/home/vi-admin/ghettoVCBg2.pl --vmlist list --dryrun 1

If running "sudo backup.sh" completes without error, you can insert call backup.sh in crontab

Tags: VMware

Similar Questions

  • The EM console has the feature archive / move logs area/application on a recurring basis as a cron job?

    Our client has determined they want the server to backup/archive/move logs regularly and need to know if the EM console has built-in features to the app itself archive/move/backup of these files on a regular basis as would a cron job.  If so, what are the steps in the console 'EM to do?

    Any comments would be greatly appreciated.

    Thank you!

    Hello

    There are several ways to reach these

    (1) If you already have a script as a cron Job, which can be automated by practice below.

    OEM--> business--> Job--> library--> create OS command ' use of the library-->

    In parameter--> choose the command type as script--> and use your script. (If you change the interpreter for usage on the host instead of the default, it is recommended to provide the full path (example: % perlbin %/perl))))

    (2) for backup Archives, as--> above, you can create job of the RMAN SCript library

    Or

    backup archives page 2) go to the database ==> "Availability", "Backup and recovery", "Backup settings" (in the location of backup of configuration etc.) and 'Recovery catalog settings' (to register for production DB in the catalog DB).

    Then you can customize the following scheduled backup:

    Go to 'Schedule backups', 'tailor-made backup', follow the full hot backup schedule screen.

    Please follow the link for more information below

    http://docs.Oracle.com/CD/E24628_01/doc.121/e24473/jobs.htm#EMADM9238

    11.3 creating jobs

    Your first task in creating a job from the job activity page is to choose a job type, resulting in the following section, Select a Type of job. The more typical kinds of work are the OS command jobs, script and multitasking works, which are explained in the following sections:

    Concerning

    Krishnan

  • How to clear a Cached region of pl/sql a cron job?

    How can I clear a region cached pl/sql running in a cron job? The APEX_UTIL.functions seem to work only in an apex application.

    Request Express 4.2.3.00.08.

    Thank you

    Thanks for the reply of Nicole.

    Yes, but I was trying to avoid getting the date of the cache for all regions cached and then questioning the last run_date from crowd on each page. (Many pages with many parts per page) Seems like a lot of overhead and coding.

    Instead, I now update batch job a flag 'CLEAR_CACHE' to 'YES' on a table of the package log when employment ends. Then added the process to each page to check the flag. If the flag is 'YES' then purge all regions and set the flag to "NO".

    Rob

  • implement a RMAN script in a cron job with a cold way of database

    Hello

    I want to run the Rman script in a cron job. But my question is: is it possible to make a backup of cold with the editing of the database and change at the end of the backup?

    here my sample rman script

    #! / bin/ksh

    export ORACLE_SID = test

    ORACLE_HOME=/U01/app/Oracle/product/11.2.0/dbhome_1; Export ORACLE_HOME

    PATH = / usr/sbin: $PATH: $ORACLE_HOME/bin. export PATH

    ORACLE_HOME/bin/rman target = / < < EOF

    Run {}

    SQL! connect / as sysdba;

    SQL! stop immediately;

    SQL! Startup mount;

    allocate channels ch1 disc type

    disc format ' / u01/app/oracle/backup/full_%d_T%T_s%s_p%p'(database).

    backup database archivelog;

    remove obsolete;

    output channel ch1

    SQL! alter database open

    }

    "exit";

    EXPRESSIONS OF FOLKLORE

    Thank you

    Hello

    No problem, when you use the rman target / it to connect with the RMAN and RMAN fast turns. You can change your order something like that

    #! / bin/ksh

    export ORACLE_SID = test

    ORACLE_HOME=/U01/app/Oracle/product/11.2.0/dbhome_1; Export ORACLE_HOME

    PATH = / usr/sbin: $PATH: $ORACLE_HOME/bin. export PATH

    ORACLE_HOME/bin/rman target = /.<>

    Run {}

    stop immediately;

    bootable media;

    allocate channels ch1 disc type

    format ' / u01/app/oracle/backup/full_%d_T%T_s%s_p%p';

    backup database archivelog;

    remove obsolete;

    output channel ch1.

    ALTER database open;

    }

    "exit";

    EXPRESSIONS OF FOLKLORE

    HTH

  • cron job first Sunday of each month

    Hello
    I have a job to run the 1st Sunday of each month

    33 7 1,73,4,5,6,7 * 0

    but his run every Sunday and every 1st to the 7th of each month

    a little confused, I thought that all checks must return true for cron job

    Hello

    Please see this:

    http://www.linuxquestions.org/questions/linux-software-2/scheduling-a-cron-job-to-run-on-the-first-sunday-of-the-month-524720/
    

    HTH
    KK

  • All cron jobs are executed by the root?

    OS: Sun OS 5.10

    I have planned an RMAN backup script that had only one line as
    rman target .............
    I logged on as user oracle os and run this script without any problems. But when I planned this job to run, it did not work.


    I got the error
    /u05/bkp_scripts/rman-level0_WM.sh: rman: not found
    The hull could not find rman binary on the WAY. Everything worked when I put explicitly ORACLE_HOME, ORACLE_SID, path in the shell script.
    This means a cron jobs scheduled per OS user oracle will always work unless you set set ORACLE_HOME, ORACLE_SID, path in shell script?

    Cron tasks is run by root user regardless of who he planned?

    Kamran certainly gave you the right answer.

    Your script runs outside the cron because it uses your environment of sessions

    Cron at least should ORACLE_BASE, ORACLE_SID, ORACLE_HOME, and probably the PATH starts to work.

    Use 'env' in the Linux/Unix command prompt to check your settings

    Build you an environment file and call it like this:

    #! / bin/bash
    #.................................................
    # Name: db_rman_full.sh
    # Purpose: Rman backup
    # Usage: db_rman_full
    #..................................................
    #

    If ["$1"]
    then DBNAME = $1
    on the other
    echo ' basename $0: syntax error: use.» db_rman_full .
    Output 1
    FI

    . /U01/app/Oracle/dba_tool/env/${dbname}.env

    ECHO ' from RMAN... »
    Target of $ORACLE_HOME/bin/rman / catalogue /@r<>

    ....

    Either way, it is a good place to ask this question. Oracle is simply an environment that runs on Unix.

  • cron job Monitor and the status of the scheduled task

    I can't find all the rules for the cron and scheduled task of monitoring, any suggestions?

    Thank you

    Rachel

    Hello

    It will be interesting to see what other solutions the Foglight user community found for this.

    A simple option I can think of is having the task cron/writing to a file log and this logfile with LogFilter monitoring officer

    http://en.community.Dell.com/TechCenter/performance-monitoring/Foglight-administrators/w/Admins-wiki/5646.monitoring-application-availability-using-Foglight-utility-agents

    Golan

  • Cron job does not

    I have watched several of the post but can't seem to get this to work.  I have the following Setup

    /etc/cron.d/test

    #! / bin/bash

    25 09 * root 1, /usr/sbin/test.sh & gt;/var/log/test.log 2 & gt;

    /usr/sbin/test.sh

    #! / bin/sh - l

    echo "- special cron backup-


    ";

    ECHO '-'.


    test.


    ";

    echo "- special cron backup-


    ";

    PhD - DD - special test;

    If I run test.sh manually, it works.  When I try to schedule it in cron it will resonate the comments in the file/var/log/test/log but the command will not trigger.  I think it's some sort of permissions problem, but I'm really a Linux guy so I don't really know what it is.  Any help would be apprciated.

    First we must find this binary:

    . # What PhD DD

    If that does not return anything then:

    . # find /-name "phd-*"-print

    If you have found this helpful at all prices please points using the correct or useful!  Thank you!

  • RMAN script does not work as a cron job, but works when explicitly executed

    Oracle 10 g 2 10.2.0.1, Oracle Enterprise Linux 4 U7.

    I've added a task to crontab of the oracle user who looks like the following:
    #ORACLE_HOME,ORACLE_SID and PATH are set in the user's profie
    TAG=`date|awk '{print $1"_"$2"_"$3}'| tr [:lower:] [:upper:]`
    
    echo "backup started on`date` "> /home/oracle/rman.log
    
    rman target / LOG='/home/oracle/rman_run.log' << EOF
    
    run{
    
    sql 'aler system switch logfile';
    backup full database tag='$TAG' include current controlfile;
    delete noprompt obsolete;
    
    }
    exit;
    EOF
    
    echo "rman finished, returned $? " >> /home/oracle/rman.log
    echo "Backup ended on `date` " >> /home/oracle/rman.log
    the tracks work as expected but the rman command never works the inside of cron, it always returns code 1, but if I call the script itself from the command line
    It works smoothly and the backup is performed.

    what I am doing wrong?

    what I am doing wrong?

    no no no ORACLE_HOME and ORACLE_SID is defined in script
    The script does not source in the script of environmental requirements

    env | Tri o /tmp/capture.env

    above indicates how deficient the script environment cron is really

  • What is the best for the managed user hot - running Backup in the Scheduler cron or oracle

    We take hot backup in our environment using the sql script to just start the backup, copy of the host and end backup

    Can we use this script to set cron job for twice a week or use the oracle Scheduler.

    Which is the best option and why?

    But you need to configure a few credintials for the planner should be able to run the executable type work.

    When you log in to Unix under account the ORACLE is runnig, you can connect to sqlplus simply by sqlplus / as sysdba.

  • Is it necessary to disable default batch jobs?

    Hi all

    I'm upgrading databases 11 GR 1 material in GR 11, 2... Below we have pre-staged at level step.

    "Disable all batch and cron jobs.
    On the work undertaken with Oracle DBMS_JOB, DBMS_SCHEDULER packages can be used about cron jobs (external works controlled at the level of the BONE), it is a task for your Unix administrator. »

    In my environment, I don't have custom scheduled jobs. I see few jobs internal under the sys user in dba_scheduler_jobs.shall that we have that turn off also? Please give your suggestions.


    Platform: Linux x 86

    Thank you

    SRJ

    Yes indeed. Its always recommended to disable all the tasks

    For the work of dbms_scheduler, EXEC DBMS_SCHEDULER. DISABLE (»);

    For automated tasks, EXEC. DBMS_AUTO_TASK_ADMIN DISABLE.

    For dbms_jobs, EXEC DBMS_JOB. BROKEN ( , TRUE, SYSDATE);

    Kind regards

    Suntrupth

  • cron on ESXi5 "operation not permitted".

    Hi all

    I have my configured script and works ok on my installation of ESXi5. But I'm hit a problem when I try to add the task that a weekly cron job. I'm editing ' / var/spool/cron/crontabs/root ' with vi. I add the necessary line, but when I try to save I get an error message indicating "operation no permittied." I checked the file permissions, are currently set to 644, with the file 'root' belonging to the root and the root owner group. Am I missing something?

    Note the information in the file.

    delete the file.

    Create the file again and put the old data back in copying it inside, now you are able to write the changes he...

    Fran: JohnsonChris [email protected]

    Skickat: den 17 oktober 2011 14:56

    Till: [email protected]

    Amne: New message: ' cron on ESXi5 "operation not permitted"

    Http://communities.vmware.com/index.jspaVMware communities >

    cron on ESXi5 "operation not permitted".

    created by JohnsonChrishttp://communities.vmware.com/people/JohnsonChris> ghettoVCB - view the discussion complete onhttp://communities.vmware.com/message/1846979#1846979

  • Help with newsletter PHP Mail script for mySQL / cron

    I'm just trying to set up a PHP script to send emails as a cron job.

    It's pretty much seems to work, but I can't do both.

    The first part is to send emails, and the second is to send a notification by e-mail to the owner of the site, confirming that the emails have been sent.

    The script looks like:

    ------------------

    <? PHP

    include_once "connect_to_mysql.php";

    $sql = mysql_query ("SELECT name user, E-mail"), Newsletter_Received from users WHERE Firstname = 'test' LIMIT 20;

    $numRows = mysql_num_rows ($sql);

    $mail_body = ";

    While ($row = {mysql_fetch_array ($sql))}

    $id = $row ['UserID'];

    $email = $row ['email'];

    $name = $row ["Firstname"];

    $mail_body = ' test - please ignore ';

    $subject = 'safari price Newsletter. "

    $headers = "from: ". " [email protected] \r\n";

    $headers. = "content-type: text/html\r\n";

    $to = "$email";

    $mail_result = mail ($ $subject, $mail_body, $headers);

    If {($mail_result)

    mysql_query ("UPDATE users SET Newsletter_Received = '1' WHERE Email = '$email' LIMIT 20");

    } else {}

    }

    }

    ? >

    <? PHP

    If ($numRows == 0) {}

    $subj = sent "Newsletter."

    $body = "news bulletin was sent to everyone.';

    $hdr = "from: ". " [email protected] \r\n";

    $hdr. = "content-type: text/html\r\n";

    mail ("[email protected]", $subj, $body, $hdr);

    }

    ? >

    --------------

    Essentially with the line

    include_once "connect_to_mysql.php";

    included, it sends the emails according to the SELECT query, but don't send email «Sent Newsletter»

    But if I take this line, of course, it does not send e-mails under the SELECT query, but it sends the email "Newsletter sent.

    Any suggestions on what might need to change for him to do both would be much appreciated!

    Thank you.

    Change this line-

    If ($numRows == 0) {}

    on this subject.

    If {($mail_result)

  • Cron via VMA 4.1

    I am trying to set up a cron job on vma 4.1 help lamw script hostOperations.pl but can not get the script to work without having to go to the credentials. If I use the s < servername vc > vifptarget on the command line and running the script without credentials hostOperations.pl it works fine.

    I suspect that the problem is the cron environment... I am running 2 separate orders in the cron 1 minute apart.

    30 12 25 01 *: name of the server root vifptarget s

    31 12 25 01 * root hostOperations.pl - Server < servername > - hostfile < hostfile-> operation exi_maint

    My knowledge of scripting is limited... is it possible to combine these 2 commands in a single script file that I could call from cron so that the environment is the same for both controls

    Thank you

    VMotioner

    Take a look at this blog post - http://www.virtuallyghetto.com/2011/01/how-to-automate-cron-vi-fastpass.html, it goes into detail. I suspect that you are missing the path LD_SHARED_LIBRARY for shared libs

  • Need help with my cron-fu...

    Howdy.

    So here's my trouble.

    I've recently updated to the vMA 4.1 for my environment. I have several scripts inherited that I'm working on the conversion of pCLI when I have time, but for now, I need to get one of them running on the vMA. Part of the script called vmcontrol.pl for its operation.

    When I run the script as a user (vi-admin) or root, it works fine. When I put the scripts in a cron job, they fail. Logging of employment shows that in the environment of cron, the script fails to compile the perl files and complains to find a shared object file. My first thought is "ah, licences", but this does not hold true.

    I know it's something obvious and easy, but I'm just not collect the points. I tried to force the path variables in the cron, I checked this in several users and I made this exact same process before on the vMA 4.0 many times and it worked then. I know it's an environmental thing, but I have just enough Fu to understand.

    I am therefore asking for help. Anyone have any ideas? All entries (and I'm working on RTFM'ing, but I thought I would work this thread at the same time) are appreciated.

    Thank you!

    -Abe



    INTEGRITAS!

    Abe Lister

    Just a guy who likes to virtualize

    ==============================

    Won't lie. I like points. I mean, if something useful for you, consider slipping a few points for him!

    You are right, its probably the path is not properly set. I would recommend that you run "env" when you are root or vi-admin login and get the PATH variable and take what adds to/etc/crontab if you try to run as admin vi-. We make you run, you can understand what you actually need roads, but given that you use the vSphere SDK for Perl scripts, you want to make sure that capture you all the paths that reference the script.

    =========================================================================

    William Lam

    VMware vExpert 2009,2010

    VMware VCP3, 4

    VMware VCAP4-DCA

    VMware scripts and resources at: http://www.virtuallyghetto.com/

    Twitter: @lamw

    repository scripts vGhetto

    Introduction to the vMA (tips/tricks)

    Getting started with vSphere SDK for Perl

    VMware Code Central - Scripts/code samples for developers and administrators

    VMware developer community

    If you find this information useful, please give points to "correct" or "useful".

Maybe you are looking for