Jump to content
Sign in to follow this  
digiwo

Проблема со скриптом

Recommended Posts

Добрый день.

Есть такой скрипт

#! /bin/sh

case "$1" in
  start|"")
        VBoxSDL -vm vbox-test -fullscreen && cp -R /home/sergej/.VirtualBox /backup && sudo shutdown -hP now
        ;;
  stop)
        ;;
  *)
        echo "Usage: startsys [start|stop]"
        exit 1
        ;;
esac

Работает, вроде копирует, но комп не выключает(((

не подскажете почему?

Share this post


Link to post
Share on other sites

скрипт запускается при загрузке Gnome в профиле юзера, поэтому думаю что без sudo он просто не будет работать.

Share this post


Link to post
Share on other sites

А, ну тогда он и с sudo не будет работать, если вы не завели NOPASSWD:shutdown в sudoerc

Share this post


Link to post
Share on other sites
Defaults        env_reset

# Host alias specification

# User alias specification
User_Alias ABSCHALTER = sergej

# Cmnd alias specification
Cmnd_Alias DOWN = /sbin/shutdown, /sbin/reboot
# User privilege specification
root    ALL=(ALL) ALL
ABSCHALTER ALL= NOPASSWD: DOWN


Так выглядит visudo

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...