您可能需要首先手动运行 currentTimestamp 命令并将其重定向到 /home/steam/exiles/lastUpdate

您可能需要首先手动运行 currentTimestamp 命令并将其重定向到 /home/steam/exiles/lastUpdate

我怎么做 ?

您可能需要首先手动运行 currentTimestamp 命令并将其重定向到 /home/steam/exiles/lastUpdate

#!/bin/sh
# NOTE: app_info_print/update uses the cache rather than pulling new information. Probably unintended. Definitely not useful for this application.
# Hence we need to delete the appcache to force a refresh
# On our system, the appcache can be found in /home/steam/Steam/appcache

# Delete appcache
rm -rf /home/steam/Steam/appcache/

# Pull new info and compare new timestamp to saved timestamp
# You may need to initially run the command for currentTimestamp manually and redirect it to /home/steam/exiles/lastUpdate
currentTimestamp=$(/home/steam/steamcmd/steamcmd.sh +login anonymous +app_info_update 1 +app_info_print 443030 +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}" | grep -E "^\s+\"timeupdated\"\s+" | tr '[:blank:]"' ' ' | awk '{print $2}')
lastTimestamp=$(cat /home/steam/exiles/lastUpdate)

if [ $currentTimestamp -gt $lastTimestamp ];
then
        /home/steam/exiles/updateconan.sh
        echo "$currentTimestamp" > /home/steam/exiles/lastUpdate
fi

感谢您的帮助

答案1

据我所知,您只需要创建一个在其自己的行上/home/steam/exiles/lastUpdate包含一个零 ( ) 的文件。0

剧本有点懒。它可以很容易地检测到该文件不存在,只需在其中插入一个零即可。

零值将触发 if 语句,该语句将插入正确的时间戳(也就是说,大概是正确的)。

相关内容