Thread: Needed to add code to shutdown PC in my bash script.
bonjour guys!
i'm making bash script in i'm downloading urls 1 one through wget. after task done, need add code shutdown pc automatically.
know,
but need type password...code:sudo shutdown -h now
there way store password script , when script reach execute shutdown line, automatically pass password?
you need run script sudo or root have permission shut system down.
so, instead of starting script "sh ./scriptname.sh", start "sudo sh ./scriptname.sh".
before that, make sure through script , make sure more specific ~/downloads/blablabla. make read /home/your-username/downloads/blablabla.
using ~ instead of /home/username may result in things being downloaded /root/downloads/blablabla. if run script root terminal, example, typing "sudo su" , running script.
honestly, wouldn't hurt post entire script intend run root second or third pair of eyes take @ first.
Forum The Ubuntu Forum Community Ubuntu Official Flavours Support New to Ubuntu [all variants] Needed to add code to shutdown PC in my bash script.
Ubuntu
Comments
Post a Comment