The musings of an IT Consultant

Feb 8 2009   12:29AM GMT

Scheduling jobs in ESXi the Easy Way

Raj Perumal Raj Perumal Profile: Raj Perumal

So continued from my previous blogs, I wanted to discuss scheduling jobs in ESXi. Due to the way ESXi is made, you cannot edit the cron jobs and expect them to still be there with their changes past a reboot. Rebooting an ESXi server clears the cron jobs. The cron jobs reset back to their default settings.

In my last blog post I spoke of a program called Plink. Plink is a command line interface to Putty. This allows us to connect to an SSH session from the command line. This can be leveraged using batch scripting and windows scheduled tasks to schedule ESXi jobs.

For my example I will show you how to schedule the ghettoVCB.sh script I spoke about in my last blog entry. Please see my detailed instructions on how to do this in my blog post here.

-RP

13  Comments on this Post

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Binderer
    I have a quastion about login. Is it possible to start the BAT file with user other than "root" ? What schould i configure auf dem ESXi für permissions? Thanks a lot!
    0 pointsBadges:
    report
  • Raj Perumal
    Hi Binderer, yes you can use whatever username you desire and then su to root after you've logged in. That would work. The downside of this file is that the password is stored in this plain text batch file. -RP
    620 pointsBadges:
    report
  • Binderer
    Hi Raj and 10x for your answer. I created a user (useradd backup) and setted the password to backup (passwd backup). So I have now my VCB.bat looking this way [CODE]c:puttyplink.exe backup@10.10.10.5 -pw backup “nohup /././. "[/CODE] But i do not get the Script running :( If I logon to the Putty-Console with user: backup and run the script manually I get the Message: [CODE]/vmfs/volumes/b03bf723-44c925a1 $ ./ghettoVCB.sh vmbackuplist This script needs to be executed by "root"![/CODE] What am I doing wrong ? In my userlist is "backup:x:503:503:Linux User,,,:/home/backup:/bin/ash". I have set also the execute/owner right over the ghettoVCB.sh but no changes. Should i really su to root to execute the VCB.sh ? How can I do this in my VCB.bat ? Thanks for your help. We really appreciate that! Best Regards, Genov
    0 pointsBadges:
    report
  • Raj Perumal
    Unfortunately Binderer, I'm not sure what the issue is as I never tried to configure it that way before. I would post on William Lam's site where his script is posted which I linked to in my blog post. He should be able to help you out better than I can. However if I do hear of the answer I will let you know. -Cheers, RP
    620 pointsBadges:
    report
  • Yeled1976
    Hi i am trying to schedule the task to run but with no success. if i run the script from the console of the esxi i have no problem. if i run it from the plink command it will just move a line down and create an empty backuplog.txt in the folder. do you have any idea what i should do next? in addition, when i run the script from the server itself and would like to stop the backup. should i "ps" and see where ash process is running and just kill it? thanks
    0 pointsBadges:
    report
  • Raj Perumal
    Hi Yeled1976, try removing the pipe to the backuplog.txt and see how that goes for you. I believe that text file will be empty unless there are any errors that appear. As for cancelling it, you can kill the process like you mentioned and then you also have to connect to your ESXi server with the VMware client and delete the snapshot that was created by the script. That should do it. -RP
    620 pointsBadges:
    report
  • Binderer
    Hallo again Raj, any Results on our issue ? Thanks
    0 pointsBadges:
    report
  • Raj Perumal
    Hi Binderer, please post your questions [A href="http://communities.vmware.com/docs/DOC-8760"]here for William Lam's script.[/A] They should be able to help you there as I am not sure of the answer. Thanks! -RP
    620 pointsBadges:
    report
  • Mcargy08
    Hi Raj, I tried to run the batch file but it doesn't do anything. Like yield said, it will work on the ESXi console but not on windows. Is there something wrong that were doing? here's my batch file c:plink.exe root@192.168.1.113 -pw password “nohup ./vmfs/volumes/datastore2/ghetto.sh /vmfs/volumes/datastore2/vmwarebackups > /vmfs/volumes/datastore2/backuplog.txt &”
    0 pointsBadges:
    report
  • Flatpack
    Hi Raj Thanks for the very useful post :-) However, I am experiencing the same issues as other people on the posts. I've copied the plink information for the scheduled task and the task runs, but nothing happens, and I get the 0 byte backup log file The commands run fine on the server, just not remotely Where should I start looking ? Thanks Simon
    0 pointsBadges:
    report
  • Mcargy08
    Hi RP, Can you advise us with the issues we are having when running the command using plink? It doesnt seem to work. Thanks,
    0 pointsBadges:
    report
  • Jbeltran
    Hi guys, unfortunately I’m not sure what the answer is. Please direct your questions to William Lam’s posting in the VMware Communities. That’s where you should be able to find the answers you’re looking for. You can find it here at this [A href="http://communities.vmware.com/docs/DOC-8760"]link[/A].
    0 pointsBadges:
    report
  • NexusGuy59
    I have a question, no one has been able to answer.I run ghettoVCB via cron on my ESXi server and it started running this morning I noticed it is still running. Now I know that it failed because I had snapshots already present however my log file is filling up and it's not letting me stop the process that is running. I thought it would be ghettoVCB, however it is not ghettoVCB after ps|grep ghettoVCB low and behold it doesn't show up in the output. So I need to know and identify which process is still running the process and kill it, anyone have any ideas at all? Thanks,
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: