I started a screen by shell script in crontab, when I entered the screen, the left side became "sh-4.1#". While I runed the script directly, it was nomal with "[root@localhost data]". What happened?
Shell script:
#!/bin/bash
cd /data
scr_name="test"
pid=`screen -ls | grep -w $scr_name`
if [ -z "$pid" ];
then
screen -dmS $scr_name
fi
And crontab is:
*/1 * * * * /bin/bash -l /data/test.sh
NOTE: it worked in CENTOS5.5, but not in CENTOS6.3, and now I want to run it in CENTOS6.3.