-
Notifications
You must be signed in to change notification settings - Fork 3
/
062.silentUpdatePackages
executable file
·53 lines (35 loc) · 1.86 KB
/
062.silentUpdatePackages
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
####silentUpdatePackages
# Script to automatically check for and install updates via apt-get if computer
# has been idle for at least an hour
#idletime=$(xprintidle);
#idleminimum="3600000";
#if [[ "$idletime" -gt "$idleminimum" ]]; then
# /usr/bin/notify-send -t 10000 "ubunsys is checking for updates..."
# sudo apt-fast -y update
# sudo apt-fast -y upgrade
# sudo apt-fast -y dist-upgrade
# sudo apt-fast -y autoremove
# /usr/bin/notify-send -t 3600000 "ubunsys updated the system"
#fi
#eval "export $(egrep -z DBUS_SESSION_BUS_ADDRESS /proc/$(pgrep -u $LOGNAME mate-session)/environ)";
user=$LOGNAME
env_reference_process=$( pgrep -u "$user" mate-session || pgrep -u "$user" xfce4-session || pgrep -u "$user" ciannamon-session || pgrep -u "$user" gnome-session || pgrep -u "$user" gnome-shell || pgrep -u "$user" kdeinit | head -1 )
export DBUS_SESSION_BUS_ADDRESS=$(cat /proc/"$env_reference_process"/environ | grep --null-data ^DBUS_SESSION_BUS_ADDRESS= | sed 's/DBUS_SESSION_BUS_ADDRESS=//')
TERM=xterm
SSH_TTY=/dev/ttyp0
PATH=./:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11
HOME=/etc/stnet
DISPLAY=:0
PWD=/etc/stnet
#/usr/bin/notify-send test
#sudo runuser -l $user -c '/home/$user/.ubunsys/downloads/ubuntuScripts-master/075.silentUpdatePackagesMessages'
#sudo -i -u $user /home/$user/.ubunsys/downloads/ubuntuScripts-master/075.silentUpdatePackagesMessages
# /usr/bin/notify-send -t 10000 "ubunsys is checking for updates..."
sudo apt-fast -y update
sudo apt-fast -y upgrade
sudo apt-fast -y dist-upgrade
sudo apt-fast -y autoremove
# /usr/bin/notify-send -t 30000 "ubunsys updated the system if proceed"
#sudo su -c "/home/$user/.ubunsys/downloads/ubuntuScripts-master/076.silentUpdatePackagesMessages2" -s /bin/sh $user
#sudo runuser -l $user -c '/home/$user/.ubunsys/downloads/ubuntuScripts-master/076.silentUpdatePackagesMessages2'