linux - i3blocks (i3wm) - use a sudo command -


i'm configuring i3blocks i3wm, , can't seem able execute sudo command like:

[update-notifier] label=update command=sudo ~/.i3/scripts/update-notifier.sh interval=once 

inside update-notifier.sh file have this:

apt-get update && apt-get upgrade 

plus echo formatting i3blocks bar. i've tried this:

  • command=sudo ~/.i3/scripts/update-notifier.sh , without sudo apt-get -> script doesn't launch
  • command=sudo apt-get update && sudo apt-get upgrade -> command isn't executed
  • command=~/.i3/scripts/update-notifier.sh sudo apt-get -> script launch, i3bar formatted, apt-get isn't executed.

do have sudo configured doesn't ask password user apt-get command? maybe command running asks password , fails.

i abled accomplish you're trying allowing user run apt-get sudo without password adding /etc/sudoers file:

<my-user> <my-host> = (root) nopasswd:/usr/bin/apt-get 

and adding block command property set second option:

command=sudo apt-get update 

and verified works reloading i3 , checking timestamp of latest update with:

stat -c %y /var/lib/apt/periodic/update-success-stamp 

which showed recent update being done recently:

2015-10-13 08:29:30.996348567 -0430 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -