Hi all,
can someone please answer few questions on shell scripts and some basic setup.
I have the below script to load geli devices, import zpool, and restart samba, then I want to start syncthing. Right now I have two scripts, one for geli and zpool, executed by root, then syncthing script executed by user "tango".
first, is it possible to run all this without the root privileges?
Then I can merge these two scripts.
This script is run as root:
then I run the below script to launch syncthing by user "tango"
also what is the default shell?
for root, env returns csh and for user it is sh?
I don't remember making any specific changes to the shell choice.
also I have a .cshalias file with some aliases for the root shell. How to use the same file for all users/shell environments, I dont want to maintain different alias files.
I also want to minimize the use of root user account for routine maintenance, right now to even shutdown/reboot, update packages, etc, need root privileges, is it possible to give the main user account (tango) the privileges needed to do these routine chores?
thank you.
yudi
can someone please answer few questions on shell scripts and some basic setup.
I have the below script to load geli devices, import zpool, and restart samba, then I want to start syncthing. Right now I have two scripts, one for geli and zpool, executed by root, then syncthing script executed by user "tango".
first, is it possible to run all this without the root privileges?
Then I can merge these two scripts.
This script is run as root:
Code:
###############
#!/bin/csh -f
# attach geli containers
geli attach /dev/label/dataE0
if ($status == 0) then
geli attach /dev/label/dataE1
if ($status == 0) then
# import zpool tank3 (on a 2-way mirror)
zpool import tank3
# mount zfs datasets from tank3
zfs mount -a
#start samba
service samba_server restart
else
geli detach /dev/label/dataE0.eli
echo detached dataE0.eli
echo failed to attach dataE1.eli, check your password.
endif
else
echo failed to attach dataE0.eli, check your password
endif
###################
then I run the below script to launch syncthing by user "tango"
Code:
###############
#!/bin/csh -f
set stamp = `date -j +%Y%m%d%H%M`
nohup /usr/home/tango/syncthing/syncthing -no-browser -logfile="st$stamp.log" -logflags="3"
###############
also what is the default shell?
for root, env returns csh and for user it is sh?
I don't remember making any specific changes to the shell choice.
also I have a .cshalias file with some aliases for the root shell. How to use the same file for all users/shell environments, I dont want to maintain different alias files.
I also want to minimize the use of root user account for routine maintenance, right now to even shutdown/reboot, update packages, etc, need root privileges, is it possible to give the main user account (tango) the privileges needed to do these routine chores?
thank you.
yudi