Tiny Core Base > TCB Tips & Tricks

/opt/shutdown.sh - some included scripts don't work

(1/2) > >>

netnomad:
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.

tinypoodle:
Where did you get the "-l" option from?

tinypoodle:
try:

--- Code: ---su -c '/usr/local/bin/script' $USER
--- End code ---

netnomad:
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.

tinypoodle:
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).

Navigation

[0] Message Index

[#] Next page

Go to full version