diff --git a/impfilesbk b/impfilesbk index 4813cec..b1eb0f2 100644 --- a/impfilesbk +++ b/impfilesbk @@ -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" "$@" || : diff --git a/impfilesbk_server b/impfilesbk_server index 1b3929a..6456a9e 100644 --- a/impfilesbk_server +++ b/impfilesbk_server @@ -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" "$@" || : diff --git a/makepkglist b/makepkglist index c5fac1d..5e8052b 100644 --- a/makepkglist +++ b/makepkglist @@ -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 diff --git a/makepkglist_server b/makepkglist_server index 368a4d4..4ac53e4 100644 --- a/makepkglist_server +++ b/makepkglist_server @@ -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