I need to find out if /sbin/ddns_custom_updated is set to 0 or 1.
How?
I am not asking how to use /sbin/ddns_custom_updated, what is it for or how to set it. Just how to read if it is set to 0 or it is set to 1 in a script.
ddns_custom_updated is not a value, it's a program that you run, providing it with either 0 or 1 as argument.
nvram get ddns_updated
if ((argc == 2 && !strcmp(argv[1], "1")) || (argc == 1)) {
nvram_set("ddns_status", "1");
nvram_set("ddns_updated", "1");
nvram_set("ddns_return_code", "200");
nvram_set("ddns_return_code_chk", "200");
nvram_set("ddns_server_x_old", nvram_safe_get("ddns_server_x"));
nvram_set("ddns_hostname_old", nvram_safe_get("ddns_hostname_x"));
logmessage("ddns", "Completed custom ddns update");
} else {
nvram_set("ddns_return_code", "unknown_error");
nvram_set("ddns_return_code_chk", "unknown_error");
logmessage("ddns", "Custom ddns update failed");
}
return 0;
Hmm, not returning anything:
Code:#!/bin/sh FLAG=$(nvram get dns_updated) echo "$FLAG"
i wil check your second answer, too
#!/bin/sh
/sbin/ddns_custom_updated 0
FLAG=$(nvram get ddns_status)
echo "$FLAG"
Welcome To SNBForums
SNBForums is a community for anyone who wants to learn about or discuss the latest in wireless routers, network storage and the ins and outs of building and maintaining a small network.
If you'd like to post a question, simply register and have at it!
While you're at it, please check out SmallNetBuilder for product reviews and our famous Router Charts, Ranker and plenty more!