Web lists-archives.com

notify-send script messed up my environment




Hello,

I stepped in poo, and broke a cardinal sin, trying a script that I
didn't 100% understand. Now my environment is a little bit jacked. Not
bad, still generally functioning. 

I was trying to get notifications to run from the command line, namely
crontab. No easy task, at least, not as easy as I would have thought.

I created and ran this script I found online:
#!/bin/bash
username=$(/usr/bin/whoami)
pid=$(pgrep -u $username nautilus)
dbus=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$pid/environ | sed
's/DBUS_SESSION_BUS_ADDRESS=//' )
export DBUS_SESSION_BUS_ADDRESS=$dbus
/usr/bin/notify-send "$(today)"

It seemed simple enough.

It even worked a few half dozen times. Until, it didn't.

I couldn't even run the script anymore, from the command line.
I get the following error:
grep: /proc/1700: Is a directory
grep: 25836/environ: No such file or directory

I tried to "man" up but can't find anything on dbus, dbus_session etc.

I think it's as simple as messing up my environment.

Can someone throw me a bone? I guess I could restart, and I assume that
should work, but that doesn't really explain to me why it broke, which
interests me more.

Thanks in advance, to anyone that can throw me a bone.