Screen keeps dying after reboot

I have screen command in my autorun.sh
Everytime I reboot, i can see that the screen is dead (screen -ls)
I try the command manually(without screen) and it works fine.

Why my screen command keeps dying?
Where is the best location to put screen command?

How did you add this command to autorun.sh, in what format?

This is the actual content of my autostart.sh

#/bin/sh

(
cd /storage/downloads/Tool/RcloneTool/tmp

curl -O https://downloads.rclone.org/rclone-current-linux-arm64.zip
unzip -o rclone-current-linux-arm64.zip
cd rclone-*-linux-arm64

cp * /storage/downloads/Tool/RcloneTool/bin
chown root:root /storage/downloads/Tool/RcloneTool/bin/rclone
chmod 755 /storage/downloads/Tool/RcloneTool/bin/rclone
cd /storage/downloads/Tool/RcloneTool/bin

sleep 1s &&

screen -dmS rclonemount /storage/downloads/Tool/RcloneTool/bin/rclone mount ijm: /storage/downloads/mount/ijm/ --max-read-ahead 256M --buffer-size 64M --dir-cache-time 24h --poll-interval 5m --allow-other --vfs-cache-mode writes

sleep 10s &&

echo password | ENCFS6_CONFIG='/storage/downloads/Tool/RcloneTool/.encfs6.xml' encfs \
-S -o rw -o allow_other -o uid=99 -o gid=100 \
/storage/downloads/mount/ijm/encfs \
/storage/downloads/mount/encfs

sleep 1s &&

echo password | ENCFS6_CONFIG='/storage/downloads/Tool/RcloneTool/.encfs6.xml' encfs \
-S -o rw -o allow_other -o uid=99 -o gid=100 \
/storage/downloads/mount/ijm/amzn \
/storage/downloads/mount/amzn

# fix bluetooth permission damage by android 
chown -R root:root /storage/.cache
chown -R root:root /storage/.config
chown -R root:root /storage/.kodi
) &

nohup script.sh &

This script works if I go to ssh, and type reboot(which confirms that the script works). If I reboot from kodi or reset my device, screen is dead. Typing reboot from ssh is doing something that reboot from kodi and reset device doesnt do. Question is, what?

About | FAQ | Terms of Service | Privacy Policy | Legal Notice