Hi! > +flag=0 > +# running under systemd? > +if command -v systemctl >/dev/null 2>&1; then > + HAVE_SYSTEMCTL=1 > +else > + HAVE_SYSTEMCTL=0 > +fi > + > +if [ $HAVE_SYSTEMCTL -eq 1 ]; then > + systemctl status vsftpd.service > /dev/null 2>&1 || flag=$? > + if [ $flag -ne 0 ]; then > + systemctl start vsftpd.service > /dev/null 2>&1 > + fi > +else > + service vsftpd status > /dev/null 2>&1 || flag=$? > + if [ $flag -ne 0 ]; then > + service vsftpd start > /dev/null 2>&1 > + fi > +fi
Hmm, what is the reason of using the flag variable instead of $? directly? And this snippet of code makes me wonder if it would be better to have a small shell library to restart the system services by a given name. Do we have other places with similar pieces of code? -- Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Monitor your physical, virtual and cloud infrastructure from a single web console. Get in-depth insight into apps, servers, databases, vmware, SAP, cloud infrastructure, etc. Download 30-day Free Trial. Pricing starts from $795 for 25 servers or applications! http://p.sf.net/sfu/zoho_dev2dev_nov _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
