暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

Mac 执行后台程序, 防止系统盒盖进入睡眠 - caffeinate

digoal 2021-01-02
888

作者

digoal

日期

2021-02-01

标签

PostgreSQL , caffeinate


背景

命令的名字 caffeinate 很有意思, 走,喝杯咖啡?让它接着运行.

例如我需要下载个大文件, 可以使用caffeinate来执行:

caffeinate -im git clone https://github.com/digoal/blog

或者直接执行 caffeinate -im

其他选项参考帮助

```
CAFFEINATE(8) BSD System Manager's Manual CAFFEINATE(8)

NAME
caffeinate -- prevent the system from sleeping on behalf of a utility

SYNOPSIS
caffeinate [-disu] [-t timeout] [-w pid] [utility arguments...]

DESCRIPTION
caffeinate creates assertions to alter system sleep behavior. If no assertion flags are specified, caffeinate creates an assertion to prevent idle sleep. If a utility is specified, caffeinate creates
the assertions on the utility's behalf, and those assertions will persist for the duration of the utility's execution. Otherwise, caffeinate creates the assertions directly, and those assertions will
persist until caffeinate exits.

 Available options:

 -d      Create an assertion to prevent the display from sleeping.

 -i      Create an assertion to prevent the system from idle sleeping.

 -m      Create an assertion to prevent the disk from idle sleeping.

 -s      Create an assertion to prevent the system from sleeping. This assertion is valid only when system is running on AC power.

 -u      Create an assertion to declare that user is active. If the display is off, this option turns the display on and prevents the display from going into idle sleep. If a timeout is not specified with  
         '-t' option, then this assertion is taken with a default of 5 second timeout.

 -t      Specifies the timeout value in seconds for which this assertion has to be valid. The assertion is dropped after the specified timeout. Timeout value is not used when an utility is invoked with  
         this command.

 -w      Waits for the process with the specified pid to exit. Once the the process exits, the assertion is also released.  This option is ignored when used with utility option.

EXAMPLE
caffeinate -i make
caffeinate forks a process, execs "make" in it, and holds an assertion that prevents idle sleep as long as that process is running.

SEE ALSO
pmset(1)

LOCATION
/usr/bin/caffeinate

Darwin November 9, 2012 Darwin
```

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论