mercredi 5 mars 2014

Execute command in script based on year


Vote count:

0




I have a Powerbook with a dead laptop battery... Everytime I disconnect it from it's power source the date gets set to back to the year 1969. This leads to some issues with network authentication, keychain access, etc. I wrote a launch daemon that executes this script in order to set the date to something more appropriate at boot, which works fantastically.



#!/bin/bash

date 0101122014


Now I on want it to only run if the year is 1969, that way if the time is correct it won't get set back at all.


so something like...



#!/bin/bash

if year = 1969
then date 010112002014
else exit 0


I know the syntax is totally off, it's just to give an idea of what I want to do. Thanks for any help in advance.



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire