home.sh update.
This commit is contained in:
parent
9352b240b4
commit
5b7b4ff27c
1 changed files with 13 additions and 3 deletions
|
|
@ -1,3 +1,13 @@
|
|||
function _home_date() {
|
||||
os_name=$(uname)
|
||||
if [ "$os_name" = "FreeBSD" ]; then
|
||||
hdate=$(date -r $1)
|
||||
else
|
||||
hdate=$(date -d @$1)
|
||||
fi
|
||||
return $hdate
|
||||
}
|
||||
|
||||
function _home_help() {
|
||||
echo "Available commands:"
|
||||
echo ""
|
||||
|
|
@ -15,7 +25,7 @@ function home() {
|
|||
cd $OLDPWD
|
||||
;;
|
||||
help)
|
||||
_foo_help
|
||||
_home_help
|
||||
;;
|
||||
pull)
|
||||
cd ~
|
||||
|
|
@ -38,9 +48,9 @@ function home() {
|
|||
last_update=$(stat -c %Y .lastupdate)
|
||||
echo "Last configuration update: $last_update"
|
||||
current_date=$(date +%s)
|
||||
echo "Current date: $current_date"
|
||||
echo "Current date: _home_date $current_date"
|
||||
time_diff=$(($current_date-$last_update))
|
||||
echo "Time difference: $time_diff"
|
||||
echo "Time difference: $time_diff seconds."
|
||||
if (( time_diff > 86400 )) || [ "$2" = "f" ]; then
|
||||
echo "Updating home configuration..."
|
||||
if git pull; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue