mac快速清空垃圾箱_mac清理

(1) 2024-08-29 19:12

Hi,大家好,我是编程小6,很荣幸遇见你,我把这些年在开发过程中遇到的问题或想法写出来,今天说一说
mac快速清空垃圾箱_mac清理,希望能够帮助你!!!。

如下:具体的find命令大家可以自己检索学习

1440是一天

➜ ~ pwd

/Users/lex

➜ ~ crontab -l

#40 10 * * * /usr/bin/find /Users/lex/.Trash/* >/tmp/stdout.log 2>/tmp/stderr.log 0 10 * * * /usr/bin/find /Users/lex/.Trash/* -cmin +1440 -exec rm '{}' \; #10 10 * * 1-5 /usr/bin/find /Users/lex/.Trash/* -cmin +4320|xargs rm -fr '{}' >/dev/null 2>&1

因为需要跟踪日志,所以稍微折腾了下

最终发现日志在这里

I was able to find cron-job log in,

/var/mail/{user-name}

mac快速清空垃圾箱_mac清理_https://bianchenghao6.com/blog__第1张

走的一些旁路:

Mac系统下crontab服务的启动和关闭

➜ ~ sudo /usr/sbin/cron start

cron: cron already running, pid: 302

➜ ~ sudo /usr/sbin/cron restart

cron: cron already running, pid: 302

By default, cron does not log output of executed jobs. It is possible to log the fact that cronjobs have been executed, but that is not the default on OS X either. In order to investigate cronjob execution output, I suggest modifying your cronjob line to redirect STDOUT and STDERR to logfiles. In your crontab file or after running crontab -e, however you go about it, add something like the following to your job line: 默认情况下,cron不记录已执行作业的输出。 可以记录cron jobs已经执行的事实,但这也不是OS X上的默认设置。 为了调查cronjob执行输出, 修改cronjob行以将STDOUT和STDERR重定向到日志文件。 在您的crontab文件中或运行crontab -e之后,无论如何,在您的工作行中添加以下内容: 0 0 * * * yourcommand >/tmp/stdout.log 2>/tmp/stderr.log 11 10 * * * /usr/bin/find /Users/lex/.Trash/* >/tmp/stdout.log 2>/tmp/stderr.log

更尝试修改/etc/syslog.conf配置文件结果遇到

系统直接报错:

Operation not permitted while System Integrity Protection is engaged

+++++https://www.technipages.com/macos-system-integrity-protection MacOS Sierra: Enable/Disable System Integrity Protection By Mitch Bartlett 1 Comment When trying to perform certain operations in MacOS Sierra, you may receive a message that states “Operation not permitted while System Integrity Protection is engaged.“ System Integrity Protection is enabled by default to not allow root access to change certain resources. You can turn System Integrity Protection on or off using these steps. 1. From the Apple menu, choose “Restart…” > “Restart“. 2. Simultaneously press and hold the “Command” and “R” buttons. This will start you in Recovery Mode. 3. Select “Utilities” > “Terminal“. 4. Type one of the following, then press “Enter“: * Disable System Integrity Protection: csrutil disable * Enable System Integrity Protection: csrutil enable 5. Restart the computer again, and the change will be made. MacOS Sierra:启用/禁用系统完整性保护 当尝试在MacOS Sierra中执行某些操作时,您可能会收到一条消息,指出``启用系统完整性保护后不允许进行操作''。 默认情况下,系统完整性保护是启用的,不允许root用户访问更改某些资源。您可以使用以下步骤打开或关闭系统完整性保护。 从Apple菜单中,选择“重新启动…”>“重新启动”。 同时按住“命令”和“ R”按钮。这将使您进入恢复模式。 选择“实用程序”>“终端”。 输入以下内容之一,然后按“ Enter”: 禁用系统完整性保护:csrutil disable 启用系统完整性保护:csrutil enable 再次重新启动计算机,然后进行更改。 +++++ 再次操作重启官方syslogd和asl的方法 sudo launchctl unload /System/Library/LaunchDaemons/com.apple.aslmanager.plist sudo launchctl load /System/Library/LaunchDaemons/com.apple.aslmanager.plist sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist 

今天的分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

上一篇

已是最后文章

下一篇

已是最新文章

发表回复