On my ubuntu server, i've many daemons and server running in the background and everytime i boot my desktop, they bootstrap on there own and start consuming cpu resources.
So, i wrote a script to stop all those server on system boot.
#!/bin/bash
#stop running some servers
serverList=("apache2" "nginx" "nfs-kernel-server" "sphinxsearch" "proftpd" "boinc-client")
#serverList=("nfs-kernel-server")
for i in ${serverList[*]}
do
shellcmd="sudo /etc/init.d/$i stop"
if $shellcmd
then
echo "Finish stopping $i"
else
echo "Fail to stop server"
fi
done
copy it to /usr/bin dir
$cp yourScipt.sh /usr/bin/
check it
$sudo yourScript.sh
Now , go to System>>Preference>>startup Application and Add
give it some name and in the command input enter "yourScript.sh". Save and close it.
Now, you're done.
If you don't find it working , consult my this article "run script on startup".
So, i wrote a script to stop all those server on system boot.
#!/bin/bash
#stop running some servers
serverList=("apache2" "nginx" "nfs-kernel-server" "sphinxsearch" "proftpd" "boinc-client")
#serverList=("nfs-kernel-server")
for i in ${serverList[*]}
do
shellcmd="sudo /etc/init.d/$i stop"
if $shellcmd
then
echo "Finish stopping $i"
else
echo "Fail to stop server"
fi
done
copy it to /usr/bin dir
$cp yourScipt.sh /usr/bin/
check it
$sudo yourScript.sh
Now , go to System>>Preference>>startup Application and Add
give it some name and in the command input enter "yourScript.sh". Save and close it.
Now, you're done.
If you don't find it working , consult my this article "run script on startup".
No comments:
Post a Comment