【发布时间】:2018-05-18 21:43:54
【问题描述】:
下面我附上了/包括我输入“crontab -l”时得到的内容命令,并使用crontab -e 进行了编辑。
我使用过THIS QUESTION'S ANSWERS - 但这并没有完全解决问题。我对编程并不陌生,但我不知道有“堆栈溢出”经验的人期望什么。请单击上面的链接以查看建议的内容。我已按照指示进行操作,但这并没有让我的 CRON 工作运行......我已经问了另外两个问题(尝试使用 Java Servlet)关于让这行 Java 代码每天被调用一次。我需要在每天上午 11:15 运行一行 Java 代码,大约需要一个小时才能完成。除了调用 GSUTIL 将文件复制到存储桶之外,它不会调用任何 Google 云服务。
如果有人知道我在 20 年前所做的 GCS 上的 CRON 作业 - 请阅读我附上的输出,并解释我如何让这两个脚本执行:
# This runs an hour of Chinese & Spanish Translation jobs
java -cp /home/rtorello75/etc/Torello.jar Torello.GCS.Main.DispatchCRON
# This is just my "feeble minded attempt" to make this work.
# It produces a "TEST.txt" file with a timestamp in my ~/home directory
java -cp /home/rtorello75/etc/Torello.jar Torello.GCS.CRON.Test
第一个是我的主要代码模块,第二个“Torello.GCS.CRON.Test”只是将一个测试字符串转储到一个测试文件@(显然)下午 5:12,现在就是这样。这实际上并没有发生......
有什么帮助吗?我正在尝试让 CRON 作业运行/执行。
rtorello75@dispatch-cron:~$ crontab -l
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
15 11 * * * java -cp /home/rtorello75/etc/Torello.jar Torello.GCS.Main.DispatchCRON
12 17 * * * java -cp /home/rtorello75/etc/Torello.jar Torello.GCS.CRON.Test
# m h dom mon dow command
【问题讨论】:
标签: java cron google-cloud-platform