Code: Select all
ACTION=="add", SUBSYSTEMS=="usb", ATTRS{serial}=="5743415A4131323437343733", RUN+="/home/emil/.exhddbakcup.sh"
Code: Select all
#!/bin/bash
{
touch /home/emil/thisworks.txt
su emil alt-notify-send "Backup message" "USB Backup device detected"
sleep 150
R=$(cat /home/emil/.backupperform)
if [ "$R" = "1" ]; then
su emil alt-notify-send "Backup Message" "It has been a while since the last backup, beginning backup."
nice -n 17 ionice -c2 -n6 /usr/bin/backintime --backup-job >/dev/null 2>&1
echo '0' > /home/emil/.backupperfom
su emil alt-notify-send "Backup Message" "Your backup has completed"
fi
} &
Code: Select all
#!/bin/sh
user=`whoami`
pids=`pgrep -u $user gnome-panel`
title=$1
text=$2
timeout=$3
if [ -z "$title" ]; then
echo You need to give me a title >&2
exit 1
fi
if [ -z "$text" ]; then
text=$title
fi
if [ -z "$timeout" ]; then
timeout=60000
fi
for pid in $pids; do
# find DBUS session bus for this session
DBUS_SESSION_BUS_ADDRESS=`grep -z DBUS_SESSION_BUS_ADDRESS \
/proc/$pid/environ | sed -e 's/DBUS_SESSION_BUS_ADDRESS=//'`
# use it
DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS \
notify-send "$title" "$text"
done
Do you have some ideas?