Equivalent date commands (FreeBSD and GNU/Linux)

I had to put dates in a string in BASH and I had this script on Linux.
The command was something like this:

echo from=`date -d "last month" +%m/01/%Y`\&to=`date -d "$(date +%Y-%m)-01 yesterday" +%m/%d/%Y`

The above did not work on FreeBSD so I had to modify it:

echo from=`date -v-1m +%m/01/%Y`\&to=`date -v-1d -j $(date +%Y%m)010101 +%m/%d/%Y`

What the above commands do is make from = “first day of last month” and to = “last day of last month.”


More simply, to print the first day of last month in Linux:

# date -d "last month" +%m/01/%Y

and in FreeBSD

# date -v-1m +%m/01/%Y

To print the last day of last month in Linux:

# date -d "$(date +%Y-%m)-01 yesterday" +%m/%d/%Y

and in FreeBSD:

# date -v-1d -j $(date +%Y%m)010101 +%m/%d/%Y

clamd not changing user in freebsd

After some upgrade of clamav it no longer started as the proper user. They try to start as the default clamav user which does not work for me.
This is the error:

Starting clamav_freshclam.
ERROR: Can't open /var/log/clamav/freshclam.log in append mode (check permissions!).
ERROR: Problem with internal logger (UpdateLogFile = /var/log/clamav/freshclam.log).
/usr/local/etc/rc.d/clamav-freshclam: WARNING: failed to start clamav_freshclam


# /usr/local/etc/rc.d/clamav-clamd start    
Starting clamav_clamd.
ERROR: LOCAL: Socket file /var/run/clamav/clamd could not be bound: Permission denied

I figured out what went wrong. the FreeBSD rc script starts clamd as clamav so then clamd itself does not have the power to change users. If you add this to your /etc/rc.conf, it may fix your problem as it did mine:


Obviously vscan should be whatever user you need to start the services as. Note that if you put “root” in there, then that makes it so clamd and freshclam have the power to change users (so if it is in the config they can do that now).

3D Graphs

I am taking multivariable calculus and I wanted some 3D graph templates and I did not really like what I saw browsing around so I made a couple word documents. The markings are really close to 1/4″ and I have two versions. One has numbers up to ten and the other does not.

3D Graph with number labels, 0.25inch markings

3D Graph No numbers, 0.25inch markings

The files are bigger than they really need to be because I did not optimize the images much.