mirror of
https://github.com/SinTan1729/random.git
synced 2024-12-25 04:48:37 -06:00
Force some scripts to run as specific user
This commit is contained in:
parent
157ff0a613
commit
00d05bda07
4 changed files with 20 additions and 0 deletions
|
@ -2,6 +2,11 @@
|
|||
|
||||
# This script backs up some important stuff
|
||||
|
||||
# force script to run as specific user
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
exec sudo -H -u sintan $0 "$@"
|
||||
fi
|
||||
|
||||
# Run only one instance of this script at one time
|
||||
[ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/impfilesbk.lock" "$0" "$@" || :
|
||||
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
# This script backs up some important stuff
|
||||
# This is the version for my home server
|
||||
|
||||
# force script to run as specific user
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
exec sudo -H -u sintan $0 "$@"
|
||||
fi
|
||||
|
||||
# Run only one instance of this script at one time
|
||||
[ "${BKLOCKER}" != "running" ] && exec env BKLOCKER="running" flock -en "/tmp/impfilesbk.lock" "$0" "$@" || :
|
||||
|
||||
|
|
|
@ -3,6 +3,11 @@
|
|||
# this script lists all packages installed in my system and saves them
|
||||
# such that it's easy to install packages in case of a system reset
|
||||
|
||||
# force script to run as specific user
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
exec sudo -H -u sintan $0 "$@"
|
||||
fi
|
||||
|
||||
# define location for output
|
||||
DIR=/home/sintan/Documents/Backup/pkglists
|
||||
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
|
||||
# this is the server version
|
||||
|
||||
# force script to run as specific user
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
exec sudo -H -u sintan $0 "$@"
|
||||
fi
|
||||
|
||||
# define location for output
|
||||
DIR=/mnt/storage/Documents/Backup/pkglists_server
|
||||
|
||||
|
|
Loading…
Reference in a new issue