-
Notifications
You must be signed in to change notification settings - Fork 36
/
install.sh
30 lines (25 loc) · 1.01 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
#
# Author: Lorenzo Padovani
# @padosoft
# https://github.com/lopadova
# https://github.com/padosoft
#
#
# Add a cron job
# ref.: http://stackoverflow.com/questions/878600/how-to-create-cronjob-using-bash
#
#write out current crontab into temp file
crontab -l > mycron
#echo new cron into cron file
echo "0 * * * * bash /root/myscript/kill-process/killprocess.sh kill top cpu > /var/log/killprocess.log 2>&1" >> mycron
echo "5 * * * * bash /root/myscript/kill-process/killprocess.sh kill top cpu > /var/log/killprocess.log 2>&1" >> mycron
echo "15 * * * * bash /root/myscript/kill-process/killprocess.sh kill top time > /var/log/killprocess.log 2>&1" >> mycron
echo "30 * * * * bash /root/myscript/kill-process/killprocess.sh kill top cpu > /var/log/killprocess.log 2>&1" >> mycron
echo "45 * * * * bash /root/myscript/kill-process/killprocess.sh kill top time > /var/log/killprocess.log 2>&1" >> mycron
#install new cron file
crontab mycron
#print result
echo "cronjobs added successfull!"
#remove tmp file
rm mycron