21 November, 2016

Where is the anacrontab log?

You can access the anacrontab like this:

awk '/anacron/' /var/log/syslog | less

Result:

root@Odin:~# awk '/anacron/' /var/log/syslog
Nov 21 08:11:58 Odin anacron[877]: Job `cron.daily' terminated
Nov 21 08:11:58 Odin anacron[877]: Normal exit (1 job run)
Nov 21 18:42:13 Odin systemd[1]: Started Run anacron jobs.
Nov 21 18:42:13 Odin anacron[845]: Anacron 2.3 started on 2016-11-21
Nov 21 18:42:13 Odin anacron[845]: Normal exit (0 jobs run)
Nov 21 20:38:31 Odin systemd[1]: Started Run anacron jobs.
Nov 21 20:38:31 Odin anacron[770]: Anacron 2.3 started on 2016-11-21
Nov 21 20:38:31 Odin anacron[770]: Will run job `db.backup' in 60 min.
Nov 21 20:38:31 Odin anacron[770]: Will run job `daglig.backup' in 200 min.
Nov 21 20:38:31 Odin anacron[770]: Jobs will be executed sequentially
Nov 21 21:05:50 Odin systemd[1]: Started Run anacron jobs.
Nov 21 21:05:50 Odin anacron[833]: Anacron 2.3 started on 2016-11-21
Nov 21 21:05:50 Odin anacron[833]: Will run job `test' in 1 min.
Nov 21 21:05:50 Odin anacron[833]: Will run job `db.backup' in 60 min.
Nov 21 21:05:50 Odin anacron[833]: Will run job `daglig.backup' in 200 min.
Nov 21 21:05:50 Odin anacron[833]: Jobs will be executed sequentially
Nov 21 20:07:06 Odin anacron[833]: Job `test' started
Nov 21 20:07:06 Odin anacron[833]: Job `test' terminated
Nov 21 22:05:50 Odin anacron[833]: Job `db.backup' started

Nov 21 22:05:50 Odin anacron[833]: Job `db.backup' terminated

Test anacrontab

Edit the anacrontab file:

nano /etc/anacrontab

Write this line:

1 1 test echo "anacron okidoki" > /home/yourUserName/anacron.log

Reboot. Wait one minute. If you see the file anacron.log in your home directory, you know that anacrontab runs.

07 November, 2016

Linux: Sound Recorder in Bash

This file is made for my research project "What You Should Know About WordPress". I need to record a series of semistructured interviews. So I needed something as simple as a soundrecorder. That's a job for bash:

#!/bin/bash

# Record interview
# Encode as MP3

# User Input
echo "I'll record sound and save the file as MP3"
echo "What is the name of your file? (Remember: .mp3)"
read filename

# Record and encode
arecord -v -f cd -t raw | lame -r - $filename