New answers tagged

2

#!/bin/bash NOW=$(date +"%s") SOON=$(date +"%s" -d "3:00 PM Sun") INTERVAL=$(($SOON-$NOW)) sleep $INTERVAL GNU date allows you to specify the format of the output, as well as the date to display. So I use the format string "%s" to get the time in seconds since the epoch, and the same for the arbitrary time using the -d paramater. Get the difference, and ...


7

if the user is allowed to use at command, this is the perfect use for that: $ at 08:00 022116 at> myscript.sh at> <----------- ctrl-d here job 9 at 2016-02-21 08:00 if you get a message like "user blah is not able to run at", ask the syadmin to add this user to at.allow file or remove from at.deny file, depending on how it is used in your ...


0

try this, it runs a simple command with arguments and puts the times $real $user $sys and preserves the exit code. It also does not fork subshells or trample on any variables except real user sys, and does not otherwise interfere with the running of the script timer () { { time { "$@" ; } 2>${_} {_}>&- ; } {_}>&2 ...


2

Usually that is ntp (the daemon named ntpd) for Network Time Protcol. For example: Network Time Protocol daemon (Arch) RHEL7: How to set up the NTP service. In Fedora, you may be looking for timedatex.service which is related to this package: timedatex is a D-Bus service that implements the org.freedesktop.timedate1 interface. It can be used to read ...


0

For that purpose it's probably better to use times (than time) in bash which prints the accumulated user and system times for the shell and for processes run from the shell, example use: $ (sleep 2; times) | (read tuser tsys; echo $tuser:$tsys) 0m0.001s:0m0.003s See: help -m times for more info.


1

Quoting 'TNW' When find figures out how many 24-hour periods ago the file was last accessed, any fractional part is ignored, so to match -atime +1, a file has to have been accessed at least two days ago. So to find a file that is only a day old, you can use either of the snippets below find /home/backups/* -mtime +0 or find . -mmin +$((60*24))


0

I ended up using the following script to launch the program and replaced it with the default pointer to the application. #!/bin/bash echo -n "$(date +%s)" >> ~/myapplog.log /application_path/ echo ",$(date +%s)" >> ~/myapplog.log It basically logs the start and stop times of the application in form of timestamp for each session in a new line ...


6

The accounting utilities (e.g. GNU's implementation) track user activity and provide a number of tools to report on it; for example, lastcomm will list the last commands executed, and sa (run as root) will provide an activity summary. To show the amount of time a given process ran, do something like sudo sa | grep chromium This will output a number ...


0

Seems like there is no real alternative to the gnu time command. So, in the end I installed just that. On OS X gnu-time can be installed with homebrew: brew install gnu-time. Thereafter CPU utilization for a specific command can be measured using gtime <command>. A test shows that my program is indeed running concurrently: 1.73user 0.13system ...



Top 50 recent answers are included