I am trying to kill a process by his name in a script.Process :toto 15408     1  0 Nov13 ?        00:20:36 java -Xmx512m -XX:MaxPermSize=128m -cp /local/toto//conf/:/local/toto//lib/* com.toto.main.entry.Launchtoto processTotoin my script :/usr/bin/sudo -u toto /usr/bin/pkill -9 -f $pnameIn sudoers :script_user server1=(toto) NOPASSWD: /usr/bin/pkill -9 -f java *It doesn't work. Either I have a sudo error (sudo: no tty present and no askpass program specified) or a pkill error (/usr/bin/pkill: invalid option -- 'X').pname contains:java -Xmx512m -XX:MaxPermSize=128m -cp /local/toto//conf/:/local/toto//lib/* com.toto.main.entry.Launchtoto processToto
pkill in a script
shell script;sudo;kill