Tiny Core Linux
Tiny Core Base => TCB Tips & Tricks => Topic started by: netnomad on February 27, 2013, 04:37:24 AM
-
hi friends,
i use some scripts on the cli without any problems...
i can use the same scripts with "sudo script" or "su tc -c -l script" without any problems, too.
the same scripts,
included at the beginning of /opt/shutdown.sh with "su tc -c -l script" or the other alternatives, don't work...
#!/bin/sh
USER=`cat /etc/sysconfig/tcuser`
HOME=`eval echo ~$USER`
su $USER -c -l /usr/local/bin/script
do you have any ideas?
i guess /opt/shutdown.sh is started by root, but i didn't find the code in the core.
any idea or all kinds of help are welcomed.
-
Where did you get the "-l" option from?
-
try:
su -c '/usr/local/bin/script' $USER
-
hi tinypoodle,
man su (debian)
-, -l, --login
Provide an environment similar to what the user would expect had
the user logged in directly.
When - is used, it must be specified as the last su option. The
other forms (-l and --login) do not have this restriction.
i tried your suggested line:
su -c '/usr/local/bin/script' $USER
and my variation without the option -l :
su -c $USER '/usr/local/bin/script'
=> both didn't succeed :(
sudo -u $USER -c '/usr/local/bin/script' doesn't work either.
thank you for your help.
-
Mea culpa!
Please disregard Reply #1, I was stuck in the past when busybox su did not feature an "-l" option (as opposed to current).
-
...doesn't matter, never mind!
i guess that when shutdown.sh starts the system is already in a state that some scripts cannot work properly anymore!?
what do you think?
do you know what exit-scripts happened when shutdown.sh starts?
thank you for your interest and your help.