I need to create a cron entry that will kick off a command at both 11:30AM and 4:00PM monday through friday. Is there anyway to do this in one entry or will I need to use two?
This would be great for anyone who has specific times to run their job that don't fall on the same minute of the hours it runs.
Currently I can only figure a two line systems as follows, is this the only way?
# 30 11 * * 1-5 /cmd1
# 00 16 * * 1-5 /cmd1
It is not possible to combine it on just one line.
What you suggest to do:
30 11,16 * * 1-5 /cmd1
would execute even at 16.30.
Then, the only way is splitting in two pieces as you already have:
30 11 * * 1-5 /cmd1
00 16 * * 1-5 /cmd1
You may try this :
30 11,16 * * 1-5 /cmd1
if you accept to change the time of the second command to 16:30.
Related
No matter how much I think about this, I cannot get the answer... The rules are fairly simple:
using only lowercase letters, from the English alphabet (no numbers or special characters allowed) tell me how many passwords of five characters can be created if there MUST be three or more vocals in the actual password.
I believe the right approach is to calculate the total amount of passwords you can create with five digits and then subtract from it those that do not fulfill the vocal requirements. Yet I have hit this mindblock and cannot seem to figure out how many passwords I need to discard.
If you could lend me a hand it would be much appreciated!
If I understood well your problem:
We count the total passwords: one letter for each position 26 * 26 * 26 * 26 * 26 = 265
Then, we calculate how many passwords we can create with three vowels: 5C3 * 53 * 212 (the vowels can be in 3 out of 5 positions, the rest will be 21 consonants to choose in the two remaining positions)
Now we calculate how many passwords we can create with four wovels: 5C4 * 54 * 21 (similar explanation as above)
We can as well have 5 vowels, don't we? So 5^5 (similar to the first point)
We then subtract all these to the total, so:
265 - 5C3 * 53 * 212 - 5C4 * 54 * 21 - 55
Edit right before going to bed: in this was we count the numbers of passwords which do not respect our standard of having at least three vowels. Since we want that, we just sum all the combinations without subtracting from the total.
Please help for easy method to solve longish multiplications and division equation.
Example like (667 x 6 x 74) / (384 x 384)
Many Thanks in advance
you can try to break it down and multiply divisions.
also it might be even better if you would sort the numbers in each group and pair the biggest of each group.
For example:
instead of (667 * 6 * 74)/(384 * 384)
you can do 667/384 * 74/384 * 6.
instead of (5 * 234 * 98 * 3433) / (2 * 34 * 7 * 333)
you can do 3433/333 * 234/34 * 98/7 * 5/2.
I want a job a to execute every 15 mins starting from 10:30 AM to 8:30 PM.
I tried 30/15 10-20 * * *. But it ignores the times 11:00 AM, 11:15 AM, 12:00 PM, 12:15 PM, 1:00 PM, 1:15 PM etc.
I would like to know the proper cron string for the above expression.
# Run command every fifteen minutes between 10:30 and 20:30.
0,15,30,45 11-19 * * * …command…
30,45 10 * * * …command…
0,15,30 20 * * * …command…
The first line deals with the whole hours from 11:00 to 19:45. The second line handles 10:30 and 10:45. The third line handles 20:00, 20:15, 20:30 (assuming you want it to run at 20:30 too — if you don't the fix is obvious).
It may not be beautiful, but it will get the job done. Just make sure the …command… sequence is simple enough that the repetition is obvious.
You can probably replace the first component of the first line with 0/15 in your cron. You might use 30/15 for the second one, but it doesn't seem any clearer than what's written anyway. I'm not sure there's a good way to replace the other line.
One other possibility is to refactor it so that the hour range for each quarter hour is specified:
0 11-20 * * * …command…
15 11-20 * * * …command…
30 10-20 * * * …command…
45 10-19 * * * …command…
You could optionally combine the first two of those.
I am writing a program in Fortran and I need a way of calculating the duration of the program down to milliseconds. I have been using the function "date_and_time", which leaves me with an array containing the system's time in hours, minutes, seconds, and milliseconds.
I believe that I can call this function at the start of my program to store the current time, then call the function again at the end of my program to store the latest time. But after that, how would I computer the duration? I tried just subtracting the values, but the milliseconds reset when one second passes, just like the seconds reset when one minute passes. How would be best way to approach this be?
Here is the program:
PROGRAM TEST_TIME_AND_DATE
INTEGER I
REAL J
INTEGER TIME_A(8), TIME_B(8)
CALL DATE_AND_TIME(VALUES=TIME_A)
PRINT '(8I5))', TIME_A
DO I = 0, 400000000
J = I * I - J
END DO
CALL DATE_AND_TIME(VALUES=TIME_B)
print '(8I5))', TIME_B
END PROGRAM TEST_TIME_AND_DATE
And here is the result:
2011 6 11 -300 9 14 49 304
2011 6 11 -300 9 14 50 688
I'm not sure what to do here, thanks.
If you want elapsed clock time, it would be simpler to use the intrinsic procedure system_clock since it provides a single time-value output. (There are additional arguments to provide information about the procedure, which is why it is a procedure instead of a function.) See, for example, http://gcc.gnu.org/onlinedocs/gfortran/SYSTEM_005fCLOCK.html. If you want to time the CPU usage, then use cpu_time. For either, two calls, at the start and end of the program, then a simple difference. You can use the COUNT_RATE argument to convert to integer count of time into seconds.
You can subtract the numbers, then convert everything into milliseconds and sum up the ms, sec in ms, min in ms, hrs in ms, ...
In your case this would be
0 + 0 + 0 + 0 + 0 + 1*1000 + 384 = 1384 [ms]
This approach works fine also with overflows since a positive number in a left-more column outweights negative numbers if they are all converted to the same basis. E.g. 0:58.000 to 1:02.200 yields
1 * 60000 + (-56) * 1000 + 200 = 4200
Please note that this does work up to days but not with months since they do not share a common length.
You could calculate the offset from some starting time (Jan 1, 1970 for UNIX) in seconds or milliseconds. The difference in those numbers is your elapsed time.
(2011 - 1970) * (number of seconds in a year) +
(month of the year - 1) * (number of seconds in a month) +
(day of the month - 1) * (number of seconds in a day) +
( ... )
I need to create a simple formula for determining the popularity of an item based on votes and age.
Here is my current formula, which needs some work:
30 / (days between post date and now) * (vote count) = weighted vote
Whenever a vost is cast for an item it checks if its weighted vote is > 300. If an item has a weighted vote more than 300 then it is promoted to the front page.
The problem is that this formula makes it very hard for older items to be promoted.
30 / 1 day * 10 votes = 300 (promoted)
30 / 5 days * 15 votes = 90 (not promoted)
30 / 30 days * 30 votes = 30 (not promoted)
30 / 80 days * 40 votes = 15 (not promoted)
How can I alter the formula to make it relatively easier for older items to be promoted (IE. make the above four weighted values fairly close together)?
Just get a graph drawing program (maybe excel, maybe matlab, maybe GNUplot) and experiment with the formula until you feel it looks right.
There's no right or wrong with these things.
Toss a logarithm on the amount of time it's been since the item was posted. Tweak the base and the constants involved. That'll take you most of the way there.