Linux stat Command in OpenWrt

Dear,
Experts, I need help to get last modified time in OpenWRT

in Linux, I am using this command to get last modification time of that file

stat -c "%Z" httpd.conf

My question is how can I use the same command in Linux which software I need to install in router, please let me if anyone know about it.

From /etc/rc.d/S00fixtime

date -r "$newest" +%s

as one way to get the modification time of a file without installing additional packages.

1 Like

its working very fine sir, thanks a lot....

can you tell me one more question?

can I make unreadable shell scripts in openwrt lede, if there is any easy way please let me know, thanks...

Let me guess, you want to hard-code passwords or other credentials in your shell scripts?

There have been various "claims" of "security" by packages like shc, which are weak, at best. Think about the problem:

  • Some unattended process needs to execute the script
  • The script is encrypted

That means that the process has all it takes to decrypt the script. Which means that the script is effectively unencrypted for any process that has the same access as that running the script. Hmmm...

Many people consider better practices for unattended tasks that require credentials to use authentication approaches like ssh keys that are bound to a specific command, thus limit potential "damage".

If it is something that can be run interactively, then entering sensitive data directly into a read or the like (not on the command line) is an option.

SELinux and the like can mitigate some of the issues, but the basic rule is if you value the credential or information, don't put it on the drive in any form that can be decrypted without direct, human action.

Edit: See also your previous thead: