I have .sh file on my macOS Catalina.
(我的macOS Catalina上有.sh文件。)
I would like to open it at eg 1 PM (I need accuracy). (我想在下午1点打开它(我需要准确)。)
So, I have already tried crontab, but something goes wrong, and I can't do it. (因此,我已经尝试过crontab,但是出了点问题,但是我做不到。)
So, Is it possible to make a program on C++ or Python to open a file at specific time?
(那么,是否可以在特定时间使用C ++或Python编写程序来打开文件?)
I have some skills in C++, but as I know there are no libs with reading current time, maybe I wrong? (我有一些C ++技能,但是据我所知,没有库可以读取当前时间,也许我错了吗?)
I haven't any knowledge in Python, but is it possible anywhere? (我对Python没有任何了解,但是在任何地方都可以吗?)
Thank you!
(谢谢!)
UPD:
(UPD:)
int main() {
struct tm *tim;
time_t tt = time(NULL);
tim = localtime(&tt);
while(!(tim->tm_hour==** && tim->tm_min == ** && tim->tm_sec == **)) {
tt = time(NULL);
tim = localtime(&tt);
}
system("...");
}
Looks like a bad idea, but it works...
(看来是个坏主意,但确实可行...)
ask by Sergey translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…