"Session and Startup" doesn't perform mount command in script on shutdown/reboot

To keep one directory in linux(ext4) and windows(ntfs) consistent, I wrote two shell scripts , pull_from_win.sh which I’d like to run on login, and push_to_win.sh which I’d like to run on shutdown/hibernate/restart. However, push_to_win.sh isn’t completed, though it is started.

Here is push_to_win.sh:

touch push_start
echo "$MYPASSWORD" | sudo -S mount /dev/sda5 /home/qiu/.ntfs
touch push_mount
rsync -au --delete /home/qiu/Documents/ /home/qiu/.ntfs/Documents/
touch push_sync
echo "$MYPASSWORD" | sudo -S umount /dev/sda5
touch push_unmount
touch push_end


If I execute it manually, it works and create push_end. But when I press the restart/shutdown button of XFCE and check it, I can only find push_start.

Maybe it can be solved by writing or modifying some systemd files, but I don’t want to do this and just would like to use the existing graphic configure interface.

So why is the mount command not be performed? What is the difference in environment when the script is executed manually or “automatically”?

(One friend of mine told me that I can add a reboot/shutdown command at the end of push_to_win.sh, and use the script to reboot/shutdown instead of buttons provided by DE. Though this method works, it will be still welcomed if you can resolve my question)