Hot answers tagged

42

The easiest of enabling unattended updates for your system is to edit the file 50unattended-upgrades inside /etc/apt/apt.conf.d/ with your favourite text editor. In it you need to comment out the commented sections of the Allowed Origins block, ie sudo gedit /etc/apt/apt.conf.d/50unattended-upgrades Change Unattended-Upgrade::Allowed-Origins { ...


41

Mark, this is a great question, and was the first one I asked when somebody told me about Juju. Here's some of the big differences. Juju encapsulates services - a charm defines all the ways the service needs to expose or consume config data to/from other services. How a charm does that is the charm's business. It can use any tool from shell scripts to Chef ...


29

You can echo the line in to the bottom of the current users crontab like this: #!/bin/bash line="* * * * * /path/to/command" (crontab -u userhere -l; echo "$line" ) | crontab -u userhere -


28

Open a terminal window and type in: sudo shutdown -h +60 and just replace 60 with whatever number of minutes you want to take. More info here: http://ubuntuforums.org/archive/index.php/t-473173.html http://www.linux.org/lessons/beginner/l5/lesson5a.html


28

(Disclaimer - I'm the founder of Puppet and CEO of Puppet Labs) I don't know juju terribly well, but from what I can tell, they somewhat sit at different layers. Puppet is great at managing the behaviors and capabilities of machines themselves, whereas juju seems primarily dedicated to talking about sets of machines and largely punts how to make the ...


27

Install unattended upgrades: sudo apt-get install unattended-upgrades Enable unattended updates on the Google Chrome repo by editing the unattended upgrades list and adding the Google Chrome repo in it: gksudo gedit /etc/apt/apt.conf.d/50unattended-upgrades Add "Google\, Inc.:stable"; to the allowed origins: Unattended-Upgrade::Allowed-Origins { "${...


27

You can use dconf-editor to change this setting. It's under: com -> canonical -> unity -> lenses and is called remote-content-search. As far as I know there are only two options none and all. When set to all the slider is set to "On" in system settings and when it is set to none the slider is at the "Off" position. You can change this ...


21

To obtain that output, you can use the command sudo /usr/lib/update-notifier/update-motd-updates-available or, if you don't want to use sudo, cat /var/lib/update-notifier/updates-available Explanation The login application shows the output found in the file /etc/motd, that is a symbolic link to /var/run/motd. This last file is updated by the mounted-...


20

Using find: find ~/tmp -type f -mtime +0 -delete ~/tmp is the directory to be searched recursively, change this accordingly -type f will look for only files -mtime +0 which will match a file if it was last modified one day or more ago -delete will just remove the matched file(s) Here the catch is -mtime +0, most might think of using -mtime +1 but find ...


19

inoticoming inoticoming is a daemon to watch a directory with Linux's inotify framework and trigger actions once files with specific names are placed in there. For example it can be used to wait for .changes files uploaded into a directory and call reprepro to put them into your repository. Manual page of inoticoming incron incron is an "...


15

The problem is that your password is required to unwrap the mount passphrase used to decrypt the eCryptfs home directory. Without that, it's not possible; the system doesn't have the encryption key yet. These login styles are mutually exclusive; you can either automatically log in (thereby letting anyone with physical access to your computer be able to ...


15

AutoKey can do everything you're asking for. You can find it in the Ubuntu Software Centre.


14

Why can't you just run this? /usr/lib/update-notifier/apt-check --human-readable That's what /usr/lib/update-notifier/update-motd-updates-available does to collect the information, at least in the version of Ubuntu I'm using (12.10).


14

Automatically set the number of workspaces; add and remove columns and rows, depending on your needs Below a version of a (the) backround script that will automatically add workspaces if you entered the last column or row of your workspace-matrix. This is how it works: If you arrive at the last column or row, additional viewports are added: If your ...


12

Autokey is a linux equivalent of AutoHotKey for Windows. (Update 01May16) The above page no longer exists. There is now a port of it to Python 3 on Github. Some of its features KDE and GTK versions available, making AutoKey integrate well into any desktop environment. Write Python scripts to automate virtually any task that can be accomplished via the ...


12

The QA team does extensive automated testing - it's part of the requirements for hardware to get Ubuntu certified. The project they use is Checkbox. Don't be fooled by the quite cut-down version shipped in the checkbox-gtk package - the full suite contains a huge range of tests. The Ubuntu QA mailing list is where you want to go for checkbox questions, or ...


12

Instead of hardcoding the password in the file, store the password in a separate file and protect the file (chmod 700 or chmod 500) so that only the authorised users can access it. Retrieve the password with cat /dir/to/file/with/.password instead of reading the file and storing the content of it into a variable.


12

You could create a crontab for the specific user like so: crontab -u <username> -e Or more simply, you could just run crontab -e when logged in as that user. Alternatively, you could prefix your command in your (root) crontab with sudo -u <username> to run the command as the specified user.


11

There is Gnu Xnee, which enables you to record and replay actions on the desktop. You can install it from the software center. "GNU Xnee is a suite of programs that can record, replay and distribute user actions under the X11 environment. Think of it as a robot that can imitate the job you just did."


11

add-apt-repository has a -y flag you can use, which should do the trick. Though I really want to suggest that you look at configuration management systems like puppet or chef to configure servers. They'll save you a lot of time!


10

First off, install numlockx (click here to install numlockx). Basically this allows you to write scripts to set the state of Num Lock - see the numlockx man page for details. Next we need to start delving into the fun of udev rules. First we need to find out how the keyboard is identified. You can do this by ls /dev/input/by-id/ This should give you some ...


9

Install gnome-schedule from the Ubuntu Software Center, load the program from Applications > System Tools. Use it to add an entry for the time you want the program to be closed like so: This will kill all instances of firefox at a certain date/time, you can also have reoccurring events that kill off certain programs at certain times, for instance to ...


9

Thanks to MinimusHeximus and the respective contributors to the thread he mentioned in his comment to my similar question, I think I can now offer you the following answer. You'll need 5 (five) files for such a USB device as follows, simply filling in respective values <fortheseparts>: /etc/udev/rules.d/00-usb-<yourdevice>.rules ACTION=="add", ...


9

How to get the currently selected text You can get the currently selected text with the command: echo $(xclip -o -sel) ...but you'd need to install xclip first: sudo apt-get install xclip From man xclip: -o, -out prints the selection to standard out (generally for piping to a file or program) and: -selection specify which X selection to ...


8

sed, the stream editor, is your friend here. For example. sed -i.bak -e's/<p id="first"/<p id="second"/' file.html would change all the paragraphs with the id 'first' to id 'second' in file.html, and create file.html.bak into the bargain.


8

I didn't like the polling approach, so I did some digging on bluez and DBus. I ended up writing the following script: #!/usr/bin/python import dbus from dbus.mainloop.glib import DBusGMainLoop import gobject import subprocess # ID of the device we care about DEV_ID = '00_1D_54_AB_DC_72' dbus_loop = DBusGMainLoop() bus = dbus.SystemBus(mainloop=dbus_loop)...


8

You need the dbus-monitor The script will look something like #!/bin/bash interface=org.gnome.Rhythmbox.Player member=playingUriChanged # listen for playingUriChanged DBus events, # each time we enter the loop, we just got an event # so handle the event, e.g. by printing the artist and title # see rhythmbox-client --print-playing-format for more output ...


7

In vim: :set softtabstop=0 :set expandtab :set smarttab :set shiftwidth=2 gg=G :retab EDIT: Explainations: lines 1-3: sane default line 4: indent with 2 spaces line 5: gg: top line =: indent until... G: ...end line 6: insure that all tabs are converted to spaces


7

What kind of service? Certain services have other methods to authenticate, e.g. SSH keys for SSH in conjunction with SSH agent. I'd store the password separate from the script, and make sure that all path components have the correct permissions set. E.g., make sure that in the path /path/to/file, /, /path and /path/to are owned by a user you trust (root) ...


7

Till now I don't think there is a way to do that normally. A tricky solution is to use restart policy sudo docker run --restart=always -d your_image This means whenever you shut down this will exit your container so as you start your host then this lead to restart the docker.



Only top voted, non community-wiki answers of a minimum length are eligible