Pergunta

I am trying to make batch commands (sh) on linux for start, stop and restart my web server lighttpd, with partial success. Ideally, I would like to doubleclick icon and nothing more to do a job.

Now, on doubleclick appear dialog "Do you want to run "START.sh", or display its contents?" and "START.sh" is an executable text file." with Run in terminal, Display, Cancel and Run buttons. Run in terminal do a job after typing password. My script look as follows:

#! /bin/bash

sudo /bin/bash /etc/init.d/lighttpd start
echo
echo -n "   [ENTER] to continue... "
read var_keypress

Is here any way for my script to run without prompted dialog and that I don't need to type password every time?

Foi útil?

Solução

You can configure sudo to be usable with no password as described here:

http://www.linuxscrew.com/2008/06/22/configure-sudo-nopasswd/

Be sure to let sudo only run specific commands without password, not all.

Outras dicas

You could avoid that with a system init script (ln -s /etc/init.d/lighttpd /etc/rc2.d/S99lighttpd on Debian) or with a crontab entry for @reboot

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top