For backup to secure file transfer, using rysnc is best choice.
Copy file from /www/backup.tar.gz to a remote server called openbsd.nixcraft.in $ rsync -v -e ssh /www/backup.tar.gz jerry@openbsd.nixcraft.in:~Output: Password: sent 19099 bytes received 36 bytes 1093.43 bytes/sec total size is 19014 speedup is 0.99
Please note that symbol ~ indicate the users home directory (/home/jerry).
Copy file /home/jerry/webroot.txt from a remote server openbsd.nixcraft.in to a local computer /tmp directory: $ rsync -v -e ssh jerry@openbsd.nixcraft.in:~/webroot.txt /tmp Password
$ rsync -r -a -v -e "ssh -l jerry" --delete openbsd.nixcraft.in:/webroot/ /local/webroot
$ rsync -r -a -v -e "ssh -l jerry" --delete /local/webroot openbsd.nixcraft.in:/webroot
$ rsync -r -a -v --delete rsync://rsync.nixcraft.in/cvs /home/cvs
You can mirror a directory between my "old" (my.old.server.com) and "new" web server with the command (assuming that ssh keys are set for password less authentication) $ rsync -zavrR --delete --links --rsh="ssh -l vivek" my.old.server.com:/home/lighttpd /home/lighttpd
Go on with the following commands as it is
# touch /root/memon # chmod 0755 /root/memon # nano /root/memon
copy below code and paste and then save by ctrl+o
EMAIL="root" # EMAIL ID TO WHICH EMAIL SHOULD BE SENT
SUBJECT="Memory Alert" # SUBJECT OF EMAIL SENT
FILE="/root/tmpmu" # TEMP FILE TO WHICH EMAIL DATA IS WRITTEN
TRIGGER=205 # TRIGGER VALUE AT WHICH CMD's SHOULD BE EXECUTED
BURST=1024 # BURST RAM ALLOTTED
GUD=256 # GURANTEED RAM
#---------------------------DONOT CHANGE ANYTHING BELOW THIS -----------------------------
MF="$(grep MemF /proc/meminfo | awk '{print $2}')"
MemFree="$(( ${MF} / 1024 ))"
MT="$(grep MemT /proc/meminfo | awk '{print $2}')"
MemTotal="$(( ${MT} / 1024 ))"
MU="$(( ${MT} - ${MF} ))"
MemUsed="$(( ${MU} /1024 ))"
BRU=0
BRTT="$(( ${BURST} - ${GUD} ))"
if [ $MemUsed -gt $GUD ]; then
BRU="$(( ${MemUsed} - ${GUD} ))"
fi
echo "Hostname: $(hostname)" > $FILE
echo "Local Date & Time : $(date)" >> $FILE
echo "" >> $FILE
echo Memory Usage(Used/Guaranteed RAM): $MemUsed/$GUD >> $FILE
echo Burst Usage: $BRU/$BRTT >> $FILE
echo "" >> $FILE
if [ $MemUsed -gt $TRIGGER ]; then
#--------SET THE BELOW COMMANDS INSIDE THE BRACKETS WHICH YOU WANT TO RUN ON TRIGGER-------
#echo "$(/etc/rc.d/init.d/exim restart)" >> $FILE
#echo "$(/etc/rc.d/init.d/mysql restart)" >> $FILE
#echo "$(abc3)" >> $FILE
echo "$(/scripts/restartsrv spamd )" >> $FILE
# /bin/mail -s "$SUBJECT" "$EMAIL" < $FILE
fi
echo > $FILE
# crontab -e
Add this line below
* * * * * /bin/sh /root/memon
This will run the script every minute. Its better not to put too much intrevals between runs. The script performs restarts and notification only when it exceeds memory trigger set by you.
In summary, editing the init script /etc/init.d/exim to change the spamassassin startup options works (if you use the init script to restart exim/spamd), but restarting Exim/Spamd via WHM will restart with the default 5 children.
search for --max-children: and change it to 1 or 2