#!/usr/bin/env sh # cron # 0 4 * * * . /etc/profile; /bin/sh /opt/ld-site/script/build_on_linux.sh >/dev/null 2>&1 export PATH=$PATH:/opt/dev_tools/node-v20.12.2-linux-x64/bin script_path="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )" original_article_home="/home/ld/Documents/ld_article" original_article_destination="/opt/ld-site/src/content" ld_site_dist_target="/opt/nginx_targets/ld_site_dist" rsync -a "${original_article_home}/" "${original_article_destination}/" cd "${script_path}/../" npm run build if [ $? -ne 0 ]; then echo "cannot build ld_site." exit 1 fi mv ${ld_site_dist_target} "${ld_site_dist_target}-old" mv dist ${ld_site_dist_target} rm -rf "${ld_site_dist_target}-old" ${original_article_destination}