I created a Focal desktop shortcut for a shell script.
However, unlike running it in a terminal window and entering my password only once,
running from the desktop shortcut requires entering my password several times, once for every step the script makes.
How could the desktop shortcut be crafted so I only need to enter my password once, upon starting.
References:
1) My Desktop snapupdate.desktop file;
Code:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=true
Exec=/usr/local/sbin/snap-update.sh
Name=SnapUpdate
Comment=snapupdate
Icon=/usr/share/icons/hicolor/16x16/actions/package-upgrade.png
2) The shell script;
Code:
#!/bin/bash
# this script starts the snapd service, deletes old snap images, does a refresh and disables it again
# put it in /usr/local/sbin/snap-update and give it executable rights
set -x
systemctl unmask snapd.service
systemctl start snapd.service
systemctl status --no-pager snapd.service
snap refresh
LANG=C snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done
sudo rm /var/lib/snapd/cache/*
systemctl mask snapd.service
systemctl stop snapd.service
kill -9 $(pgrep snapd)
3) Original Source : https://gist.github.com/rubo77/15366...8c306f9389a573
Thanks,
-------
PS: I also have a date usage desktop shortcut that runs fine (if anyone is interested)
My Desktop graphusage.desktop file;
Code:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/usr/local/sbin/graphusage.sh
Name=GraphUsage
Comment=graphusage
Icon=/usr/share/icons/hicolor/16x16/actions/package-upgrade.png
The shell script;
Code:
#!/bin/bash
# this script runs vnstati
# put it in /usr/local/sbin/graphusage.sh and give it executable rights
vnstati -s -i enp0s25 -o ~/Desktop/UsageSummary.png
See attached desktopIcons.png & graphusagechart.png
-----
Bookmarks