0% found this document useful (0 votes)
10 views3 pages

Job Automation

The document outlines various methods for job automation and task scheduling, including crontab, anacrontab, at jobs, and batch jobs. It details how to create and manage scheduled tasks, including syntax for scheduling and user permissions. Additionally, it provides examples of job scheduling commands and configurations for each method.

Uploaded by

bharathbabu2022
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Job Automation

The document outlines various methods for job automation and task scheduling, including crontab, anacrontab, at jobs, and batch jobs. It details how to create and manage scheduled tasks, including syntax for scheduling and user permissions. Additionally, it provides examples of job scheduling commands and configurations for each method.

Uploaded by

bharathbabu2022
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Job Automation / Task Sheduling.

--------------------------------------
job/task--- an action / work

creating a process/task to run automatically on a specified time if requires


repetedly.
1.crontab
2.anacrontab
3.at job
4.batch job

1.crontab
creating a process/task to run automatically on a specified time if requires
repetedly as minutes,
hourly,daily,weekly & monthly.

output
cat /var/spool/mail/root
and
cat /var/mail/root

Deamon/Service cron.d
root user
vi /etc/crontab //for Every Job

vi /etc/cron.hourly
vi /etc/cron.daily
vi /etc/cron.weekly
vi /etc/cron.monthly

cat /etc/crontab
application user & root:
$crontab -e //to shedule

$crontab -l //to view


files are

Example 100 user's


case -1 --> 10 denied 90 allowed
vi /etc/cron.deny ----------xxxxxxxxxxx
case 2--> 90 denied 10 allowed
we have create following file then cron.deny file will be removed from status
que
vi /etc/cron.allow

special char

* Every Occurence
, Specific time
- in b/w time
/ freq time

#date
Sheduling Jobs
vi /etc/crontab //root user
00-59 00-23 01-31 01-12 0-6
min hr day_mon month day_week username cmd/script_file
c1 c2 c3 c4 c5 c6 c7
* * * * * root date
10,20 10,14,18 1-10 * 1-5 root who > /dev/pts/0
00-10 10,18 1-5 * * root lastb
*/5 */2 */2 * 1-6 root tail /etc/passwd > /dev/pts/0
00-10 10,18 1-5 * * root /code.sh

#tty //to know the terminal name


/dev/pts/0

#crontab -e
#crontab -l
00-59 00-23 01-31 01-12 0-6
min hr day_mon month day_week cmd/script_file
c1 c2 c3 c4 c5 c6
* * * * * date > /dev/pts/0
10,20 10,14,18 * * * who
00-10 10,18 1-5 * * lastb > /dev/pts/0
*/5 */2 */2 * 1-6 tail /etc/passwd
10,20 10,14,18 * * * /code.sh > /dev/pts/0
---------------------------------------
#vi /code.sh
mkdir test
cd test
touch a b c d
echo "Hello everyone" > a
echo "Files Created"

(save the file)


666
022
----
644
----
#chmod 755 /code.sh
or
#chmod +x /code.sh
-----------------------------------------------------------------------------
2.anacrontab
Using this tool we can excute job skipped in crontab.
this tasks are excuted maximum once in a day.
vi /etc/anacrontab
#period in days delay in minutes job-identifier command
1 5 cron.daily nice run-parts
/etc/cron.daily
7 25 cron.weekly nice run-parts
/etc/cron.weekly
@monthly 45 cron.monthly nice run-parts
/etc/cron.monthly
1 10 cronjobs nice run-parts
/etc/crontab
------------------------------------------------------------------------------
3.at job
this jobs are single run jobs.
we can shedule jobs based on time.
syn: #at <time> //24 hrs or 12 hrs
e1.#at 10:00am
at>/code.sh > /dev/pts/0
at>who
at> uptime > /dev/pts/0
at>ctrl+d //to save
#atq //to view at jobs
#atrm job_id //to remove a job
e2.#at now
at>date > /dev/pts/0
at>ctrl+d

e3.#at now +1min/hour/day/week/month //to delay job

files are
Example 50 people
case1 40 allow 10 deny
vi /etc/at.deny XXXX
case2 40 deny 10 allow
vi /etc/at.allow
-----------------------------------------------------------------------------------
-----
4.batch job
to excute batch job system load avg must below 0.8
#batch
at>systemctl restart network
at>ctrl+d
#atq //to view batch jobs
#atrm <job-id> //to remove jobs
-----------------------------------------------------------------------------------
-------

You might also like