Cron and Cron Job : Do Works Without Shell


Cron is less known but almost universally present feature on any kind of server with an usual control panel.One can perform works via Cron Shell . Those who have very good grasp on UNIX, uses this nifty Cron program to execute commands or scripts automatically at a specified time/date, like taking a backup. Unlike the CLI, which is absent in most Shared servers, some VPS, special Cloud Hosting Platforms, Cron is typically present in most web hosting control panels.

 

What is this Cron ?

 

Cron is a program that needs to be installed on the server to use the feature. Cron is a job control program mainly developed for UNIX or UNIX like operating systems including , BSD, Mac OS X . Cron job is automatically set work via scripting which will at a specified time.

Cron is not necessarily only for UNIX OS, there is Cron for too.

 

How Cron and Cron Job are done

 

There is usually a button to set cron from control panel, its like this for Rackspace Control panel :

 

Cron and Cron Job

 

It depends on the server setup, which programing language cron will support, user have to write the script in text editor, name it with specific extension, like .sh extension and select other parameters :


 

cron job

 

In other words, instead of normal execution of the script, which might be impossible without command line interface, or may be pathetic (like repeated works), user can set it via control panel, but the scripting must have to be done and uploaded via (S)FTP. The path will be Linux path, like

 

/mnt/servername/user/website folder/itishere/script.sh

 

Usually the red colored path is needed to be added as the control panel can detect and append the rest.

 

Example of cron to extract and compress

 

Typical example is :

 

#!/bin/sh
tar -cvzf /DESTINATION/DIRECTORY/file.tar.gz /SOURCE/DIRECTORY/

 

In the same way, we can uncompress the tarball. This is written in Perl. So, the user need to write the correct path names in a text editor and save it as Perl script (not text file) otherwise Cron will not work.
Signature


0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.
About Abhishek

Abhishek Ghosh is an Orthopedic Surgeon, Inventor with 216 Patents, Current editor of The Customize Windows Media Group. You can follow and know more about Dr. +Abhishek Ghosh on Google Plus and follow on Twitter as @AbhishekCTRL.

Trackbacks

  1. Cron and Cron Job : Do Works Without Shell says:

    [...] Cron and Cron Job can Do Works Without Shell access [...]

Speak Your Mind

*