Launch Linux Shell Scripts from Anywhere
#su - root
#mkdir /scripts
#export PATH=$PATH:/scripts
#cd /scripts
#pico /scripts/somescript.sh
---------------------------------------------------
#!/bin/bash
echo "Hello World"
---------------------------------------------------
#chmod +x somescript.x
#cd /
#somescript.sh
Another Method
The script Copy your script to
cp yourscript.sh /usr/local/bin/
then
updatedb
will run from anywhere and all is good to go.
Verify the environment variable
# env | grep PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/mysecureshell_1.31
The script Copy your script to
cp yourscript.sh /usr/local/bin/
then
updatedb
will run from anywhere and all is good to go.
Verify the environment variable
# env | grep PATH
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/mysecureshell_1.31
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.