Ubuntu: Boot counter script not working



Question:

I'm using Ubuntu 14.04.04 I've written a simple script for storing in a file the number of times the sistem has been turned on and the time and date of the last boot

#!/bin/bash  file="/$HOME/bootcnt.dat"  bootdate="$(date)"  if [ -f $file ];  then    source /$HOME/bootcnt.dat    BootCount=$((BootCount+1))  else    BootCount=1  fi  echo BootCount=$BootCount > /$HOME/bootcnt.dat  echo "LastBootDate=\"$bootdate"\" >> /$HOME/bootcnt.dat  

i've copied the script file bootcounter.sh int the folder /etc/init.d and used the command sudo update-rc.d bootcounter.sh defaults

The problem is that launching manually the script from /etc/init.d it works correctly but it is not called automatically after each system boot. What is the problem?

Thanks


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »