简体   繁体   中英

How can I use dtrace (or whatever) to find out where the config file is for ddclient on my mac?

I cannot find an example of how to do this anywhere: I have ddclient installed on my mac, but none of the command line switches appear to have any effect, so I'm trying to modify the config but I can't find the darn thing.

So I figured that since dtrace is supposed to be like strace I could run dtrace and figure out what file ddclient is opening up... but

dtrace -n 'proc:::exec-success { trace(curpsinfo->pr_psargs); }'

from handy one-liners doesn't appear to take any arguments. So how can I figure out where my config is?

As it turns out, dtrace is not designed to spawn processes for you, you have to do that yourself in a separate shell.

The correct command is actually:

sudo dtrace -n 'syscall::open*:entry /strstr(copyinstr(arg0), "ddclient.conf") != NULL/ { printf("%s %s",execname,copyinstr(arg0)); }

Then in a different terminal, run ddclient as normal. You'll see in the dtrace window something like this:

CPU     ID                    FUNCTION:NAME
  2    166                       open:entry perl5.18 /usr/local/etc/ddclient/ddclient.conf
  2    166                       open:entry perl5.18 /usr/local/etc/ddclient/ddclient.conf

And that's where the config file will be.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM