Skip to main content

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,

code:
sudo shutdown -h now
but need type password...

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

Popular posts from this blog

How to decompile jsxbin to jsx

Gavik Photoslide GK2: Not able to upload photos - Joomla! Forum - community, help and support

Phoca Guestbook logger registret bruger af - Joomla! Forum - community, help and support