im simple message default title
PostgreSQL coub css express.js freeware git jquery laravel links linux macos mysql node.js php python task1 ubuntu vim virtualbox анекдот игры интересно музыка стихи цитаты

Ubuntu: как запустить скрипт от имени другого пользователя March 24, 2013
Мне это понадобилось для автоматического подъема сервиса после внештатной перезагрузки сервера.
Как всегда, все просто:
su USER -c '/home/USER/folder/script.sh'
Собственно man su рассказывает всё в примерах.
su man -c catman
# Runs the command catman as user man.  You will be asked for man's password unless your real UID is 0.

su man -c 'catman /usr/share/man /usr/local/man'
# Same as above, but the target command consists of more than a single word and hence is quoted for use 
# with the -c option being passed to the shell.  (Most shells expect the argument to -c to be a single word).

su -l foo
# Simulate a login for user foo.

su - foo
# Same as above.
linux ubuntu

Comments

No comments here yet.
You have to login to post a new comment.
HO-HO-HO!! L10 is here.
dance-dance #3
update new 01.10.2023