You are not logged in.
I am half-way through a process of converting all of my windows validation to Linux validation. I have created a temporary shell script (to be improved later) that runs around 200 lines of:
sudo sh -c "wine fsum.exe ~/mnt/folder1/myapp1.iso" >> ~/checksum.log
sudo sh -c "wine fsum.exe ~/mnt/folder1/myapp2.iso" >> ~/checksum.log
sudo sh -c "wine fsum.exe ~/mnt/folder2/mygame1.iso" >> ~/checksum.log
...
The above lines are all contained within a shell script. I am running this in a BL terminal window.
The problem is, after around 30 minutes in, the script is interupted as BL prompts for the administrator password. If I type this in, the script continues to run, but it will ask me again after about the same time. This is not convenient as the script needs to run for several hours unattended.
The files that are being validated reside on a samba network share, the app being run in WINE is running from the local machine, which then logs the output results and collates them locally.
At first, I thought it was the power management settings so I disabled all suspending and hibernating and everything is set to "Never". I left the machine running overnight and the screen didn't turn off, but I saw that the script has been interrupted again, about 30 - 60 minutes or so since the last password entry.
I am assuming that the network connection to the samba share is being suspended after some time of inactivity, regardless of power management settings. How can I resolve this?
Last edited by jimjamz (2016-08-10 15:12:19)
Offline
It is rarely a good idea to have sudo inside scripts. Instead, remove the sudo from the script and run the script itself with sudo:
sudo myscript.sh
That way, all commands within the script will be run with root privileges and you only need to give the password once when launching the script. If you need a particular command within the script to be run without sudo privileges, you can run it as a regular user with (thanks Lie Ryan):
sudo -u username command
That should at least solve part of the problem.
p.s. No idea about samba, but I have something like this in my fstab for specific samba mount
//server/folder /home/user/mount/here cifs username=user,password=pass,domain=domain,uid=1000 0 0
and it appears to be mounted 24/7.
Last edited by brontosaurusrex (2016-08-08 09:57:06)
Online
Thank you very much for all the feedback. I might be tempted to adopt the correct practice and try and have the script without use of sudo.
The sudo -v option sounds handy, but in my case, it may take more than 15 minutes for one instruction within the script to complete, missing the opportunity of re-validating for the next one (this is likely to occur especially on some largeer files being validated).
Offline
Removing sudo from the commands within the shell script did the trick. It was able to run for hours without my intervention. Many thanks. Solved!
Offline