i have some problem. I need to add in autorun of linux, some scripts. But in my infrastructure, i have a different distrs. Of course, the way of adding this scripts in autorun different. In CentOS it is chkconfig, in debian/ubuntu it is update-rc.d. So, i have some script:
function autorun () {
if [ -f /etc/debian_version ]; then
os="Debian $(cat /etc/debian_version)"
echo $os
update-rc.d ${i} defaults"
elif [ -f /etc/redhat-release ]; then
os=`cat /etc/redhat-release`
echo $os
chkconfig --add ${i}"
else
os="$(uname -s) $(uname -r)"
echo $os
echo "Other OS. Please check type of autorun in your OS"
fi
}
$i=nginx
autorun $i
Yes, it's works. Can i write this without variable declaration, like this:
autorun nginx
Please help, may be you can propose other way, that will be good. Thanks.