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() {
|
function _home_help() {
|
||||||
echo "Available commands:"
|
echo "Available commands:"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
@ -15,7 +25,7 @@ function home() {
|
||||||
cd $OLDPWD
|
cd $OLDPWD
|
||||||
;;
|
;;
|
||||||
help)
|
help)
|
||||||
_foo_help
|
_home_help
|
||||||
;;
|
;;
|
||||||
pull)
|
pull)
|
||||||
cd ~
|
cd ~
|
||||||
|
|
@ -38,9 +48,9 @@ function home() {
|
||||||
last_update=$(stat -c %Y .lastupdate)
|
last_update=$(stat -c %Y .lastupdate)
|
||||||
echo "Last configuration update: $last_update"
|
echo "Last configuration update: $last_update"
|
||||||
current_date=$(date +%s)
|
current_date=$(date +%s)
|
||||||
echo "Current date: $current_date"
|
echo "Current date: _home_date $current_date"
|
||||||
time_diff=$(($current_date-$last_update))
|
time_diff=$(($current_date-$last_update))
|
||||||
echo "Time difference: $time_diff"
|
echo "Time difference: $time_diff seconds."
|
||||||
if (( time_diff > 86400 )) || [ "$2" = "f" ]; then
|
if (( time_diff > 86400 )) || [ "$2" = "f" ]; then
|
||||||
echo "Updating home configuration..."
|
echo "Updating home configuration..."
|
||||||
if git pull; then
|
if git pull; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue