Linux  - 6

Linux - 6

cronJob

·

2 min read

Automating/ scheduling the task commands

cron : It is a daemon that executes schedule commands. cron also read /etc/crontab

crontab : crontab is the program used to install , uninstall or list the tables used to drive the cron daemon in vixie corn

cron tab Format

minutehourday of monthmonthday of weekcmd / script
0-590-231-311-12 or Jan -dec0-6 or sun - satuser/bin/find

{ \/\*** /home/suma/devops/lshmd.sh >> /home/suma/lshmd.log 2>&1

Time for every min /path(home/Ec2)/file(helo.sh) >(redirect) /(path)home/ec2/hello.log(given to another file) 2>&1 (file descriptors) }

To check which corn job are there- crontab -1

To create a cron file - touch /etc/cron.allow

\> ___the symbol called redirect standard output

file descriptions ---all the error and correct file will be redacted to here

0 --- std input

1 --- std output

2 --- std error

create a cron job file :

vi hello.sh

echo "hello guys"

echo " GM/GA/GE"

echo "today date is"

date

echo "crontab demo.."

add crontab as follows (here we have to add path)

Cron jobs logs ---- cat /var/log/cron

remote access commands

to connect servers

go to instance and follow this commands

Change the passwd to yes instead of No

Then restart the service for command is -service sshd restart

How to copy servers

Scp filename username@hostname/ip: /tmp/

Offline install

rpm - ivh <pkgsample1>

pkgname-version-release-arch.rpm

rpm-q sample 1

rpm-e sample1 ( to remove)

rpm-ivh (samplelink) '- to install

rpm-qi ( for information package )

rpm-qk ( to list package)

rpm-qr ( to check dependency )

rpm- UVH ( to upgrade & install)

Online installation For redhat/linux/centos

Yum

yum install sample1

yum remove sample1

yum update sample 1

yum list ( all installation list)

For ubuntu

apt install sample1

apt remove sample1 ..

How to start service

service sample1 start

service sample1 restart

service sample1 reload

service sample1 stop