#!/bin/bash
log_file="/run/simul_out.dat";
echo "#CAN_LOG" > "${log_file}";
echo "#system: `/bin/uname -a`" >> "${log_file}";
echo "#uptime: `/usr/bin/uptime`" >> "${log_file}";
/usr/sbin/rdate -s tik.cesnet.cz
echo "#date: `/bin/date`" >> "${log_file}";
echo "#log_file: ${log_file}" >> "${log_file}";
/usr/local/bin/candump -t a -H can0 >> "${log_file}";
if [ $? -ne 0 ]; then
	echo "#hwstamps: no" >> "${log_file}";
	candump -t a can0 >> "${log_file}";
fi;
