Home | Hardware | Internet News |Web Hosting |IT Management |Network Storage
LinuxPlanet
Search 
  Power Search | Tips 

 Front Door
 Discussion
 LinuxEngine
 Opinions
 Reports
 Reviews
 Tutorials
 News
 Technology Jobs

 Browse by subject.
Free Newsletter

Linux Planet
Linux Today
More Free Newsletters

Be a Commerce Partner


















internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers

Print this article
Email this article

   LinuxPlanet / Tutorials



Major Tom, This is Job Control
Combining Commands

Jay Fink
Thursday, July 27, 2000 10:03:08 AM

We all know Linux is about small, clean utilities and tools that work well together. The aforementioned tools, commands and utilities are no different. As an example, lets say I have two jobs that run overnight. The first job is a tar job that makes a raw backup of my home filesystem. The second is a cleaner script for the system. Additionally, for the sake of argument, we will say during the night the system is doing downloads. Now we obviously want the backup to have a pretty high priority. So our crontab might look like this:

  0 2 * * * /usr/bin/nice -n 0 cd /home; tar -cf /dev/hdb myhome 2>&1
  0 0 * * * /bin/rm -rf /var/tmp/* 2>&1

So we ensure that the tar job has a priority of 0. (The default priorities are: c for at and E for batch.)

Here are some further examples of these commands in action.

nice
To start a job off with a nice priority of 3 under Linux:

  nice 3 job_name

renice
To lower a job's nice number and hence raising its priority to 3 with a PID of 1253:

  renice -n 3 -p 1253

simple background job submission
To enter commands into the background simply use the ampersand symbol:

  mv -f dirname_one new_dirname_one &
  mv -f dirname_two new_dirname_two &

To check the number of jobs and their status use:

  jobs

batch

To submit a script named exec_file.sh to the queues at 1400:

batch 1400 -f exec_file.sh

at
to submit a script to at named exec_file.sh at 1504:

  at -f exec_file.sh 1504

cron
The cron fields are as follows from left to right (the top of the list being the leftmost field):

  - minutes_after_the_hour 
  - hours 
  - days_of_the_month 
  - months_of_the_year 
  - weekdays

To submit the file /home/myscripts/exec_file.sh to run at 3 a.m. every Monday:

  00 3 * * 1 /home/myscripts/exec_file.sh 2>&1

Next: Okay, Genius, When Does This Come in Handy? »

Skip Ahead

1 Acting Nice with the Linux System
2 Batch Processing and Scheduling
3 Combining Commands
4 Okay, Genius, When Does This Come in Handy?





Linux is a trademark of Linus Torvalds.


internet.com home | search | help! | about us

Jupiter Online Media

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers