1) Using the line above, why does the dd action stop? If I take the " & tail mylog" off, it works and writes to the file just fine.
2) Why can I not get this to run in a script from a desktop icon?
3) Is there a better way to do this? It has to be easy for the end user so the hope would be a double click on the desktop icon, password for sudo is fine and then the process runs with an easy to read status.
I have several more action icons to make after this one so hopefully this will get me on the right track.
Okay. I see where you are going with this but it still does not show the status. Just a blank screen while the dd runs. This is an Ubuntu machine if that makes any difference.
That didn't work either. I just get a blank white background terminal screen after I type in the sudo password. Once I type CTRL+C the screen disappears. I do see dd running in another window using top.
I really like the look of pv and have been trying to get that to work. So far I have this:
It took me awhile to figure out that I would need to echo the password twice. I get no error but it also doesn't do much. administrator@kiosk1:~$ echo '123456' | sudo -S dd if=/dev/zero bs=10M | pv -s 16G -N dd | echo '123456' | sudo -S dd bs=10M of=/dev/sdb0+1 records in0+1 records out9 bytes (9 B) copied, 0.0048828 s, 1.8 kB/s dd: 0B 0:00:00 [ 0B/s ] [> ] 0% administrator@kiosk1:~$
I think sudo may be my problem. I remember a few version ago where you could sudo su and be done with it. I know the dangers but this PC will not be on the network and will only be used by IT folks for a few specific tasks.
arnold
you may need to escape some parameters
xterm -e "sudo watch dd if=/dev/zero of=/dev/sdb bs=4k \> mylog \& tail mylog"
I.e. the & was sending "xterm -e "sudo watch dd if=/dev/zero of=/dev/sdb bs=4k \> mylog" into the background and there is no interface to run the tail mylog.
You may have to add another escape if this does not work.
xterm -e "sudo watch dd if=/dev/zero of=/dev/sdb bs=4k \\\> mylog \\\& tail mylog"
Helixx
ASKER
Okay guys. I got it working. I really wanted to use pv as it has a much easier to read output but the sudo chaining was causing issues so this is what I ended up doing. Also note, this takes the echo of the password out of the script so a little better security for when it matters.
sudo passwd root // I wanted to get away from sudo and back to a su environment.
xterm -e su -c 'bash /home/administrator/Desktop/clean.sh && bash' // I
added the su to the launcher. Don't forget that the path will change so add back the full path to the script.
below is the finished clean.sh listed above.
#!/bin/bash
echo "WARNING!! CF card will be wiped!"
echo "ALL DATA WILL BE LOST!"
echo "Press CTRL+C to stop this process now"