我想在不使用root的情况下在mac os x上启动.sh类型或.py文件,我在google搜索并发现launchctl可以帮助我,
所以我读教程并在教程中做同样但它不适合我,[我使用mac os x 10.9 x64]
我的.plist文件[每隔60秒运行1.sh文件]:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.alvin.crontabtest</string>
<key>ProgramArguments</key>
<array>
<string>/Users/paul/Desktop/1.sh</string>
</array>
<key>Nice</key>
<integer>1</integer>
<key>StartInterval</key>
<integer>60</integer>
<key>RunAtLoad</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/AlTest1.err</string>
<key>StandardOutPath</key>
<string>/tmp/AlTest1.out</string>
</dict>
</plist>
Run Code Online (Sandbox Code Playgroud)
1.sh的来源:
echo '+' >> /Users/paul/Desktop/worked.txt
Run Code Online (Sandbox Code Playgroud)
我将Run.plist放在/Users/paul/Run.plist中
并从终端运行命令:
launchctl load /Users/paul/Run.plist
Launchctl start com.alvin.crontabtest
Run Code Online (Sandbox Code Playgroud)
命令执行没有任何错误,但我没有看到working.txt中的任何内容
有人可以帮我吗?
如何使用 chmod() 更改 Assembly linux x86 中的文件权限?我想要汇编中的示例代码,我看到帮助指南,但仍然很难理解
http://man7.org/linux/man-pages/man2/chmod.2.html
int chmod(const char *pathname, mode_t mode);
Run Code Online (Sandbox Code Playgroud)
chmod() 有 2 个 argv ,第一个是路径文件名,第二个是 mod !
路径 /Users/paul/Desktop/file.txt 和 mode_t 模式为: S_ISUID 、 S_ISGID 、 S_ISVTX 、 S_IRUSR 、S_IWUSR
更多内容可以在 url 第一个问题中看到:我需要在 ecx 的变量中设置这些值,或者我必须使用值数字,我必须使用哪个?S_IWGRP 或 00020 #按组写入
第二个问题:我真的这样做了吗?我将它们放入 ecx 并执行相同的操作:
mov eax,15
mov ebx,mypathfile
mov ecx,S_IWUSR
int 0x80
Run Code Online (Sandbox Code Playgroud)
有人可以给我代码示例吗?
最后一个问题是,如何设置文件的 777 权限(对所有人进行读写执行)?
谢谢。
xor ebx,ebx
mov eax,DWORD PTR fs:[ebx+0x3]
Run Code Online (Sandbox Code Playgroud)
我知道这段代码的第一行,但是什么fs:[ebx+0x3]?为什么在编译时给我一个错误?
test.asm:2: error: comma, colon, decorator or end of line expected after operand
Run Code Online (Sandbox Code Playgroud)