Crontab Shut down command didn't work
4,842
You have configured the crontab
wrong do as following:
In terminal type:
sudo crontab -e
Then give the entry for it like:
30 02 * * * /sbin/shutdown -h now
Related videos on Youtube
Author by
Mat
Updated on September 18, 2022Comments
-
Mat over 1 year
I'm creating an API using C# and ASP.NET Web API and I want it to return an error when a parameter is used that isn't recognised.
For example:
/api/Events
should a list of events
/api/Events?startTime={{startTime}}
should return a list of events that started at a particular time
/api/Events?someRandomInvalidParameter={{something}}
should return an error
Is there a nice config way to do this? If not, how can I get a list of parameters to check myself.
-
Admin over 10 yearsok but how to save it in Terminal? because I don't see save function over there.
-
chadwicke619 over 10 yearssee the link here: help.ubuntu.com/community/CronHowto
-
chadwicke619 over 10 yearsyes it will work every day. Don't need to do anything. See the link above to get more familiar with how to set crontab.
-
Mat almost 8 yearsThanks, Anton. Should this work even in the case where one parameter is valid and one is not? e.g.
/api/alive?id=1&blablabla=1
From my limited testing, if I have at least one valid parameter it will still bind to one of my Get methods - could it be because I am using some optional parameters?string startTime = ""
-
Anton Kozlovsky almost 8 yearsYes it will work because Action will try to find id parameter and will ignore all others. Even localhost:1578/api/alive?qwe=2&id=1 will work.
-
Mat almost 8 yearsHow can I make it not work? I want the user to be notified if they add qwe=2 and it doesn't do anything.
-
Anton Kozlovsky almost 8 yearsWait a bit i will investigate this, in my opinion we should change routes
-
Mat almost 8 yearsHi Phong, I want to use parameters because I don't want to explicitly set the URL like that. What if I want to have more than one optional parameter? What about ordering? Also I don't know in advance what invalid parameters people might use.
-
Phong Nguyen almost 8 yearsThis parameter is match with position of value that user input in URL.localhost:8080/app/Events/19901101 localhost:8080/app/Events/19901101/something
-
MarAvFe over 5 yearsOk, done. Also my situation changed since I posted, so check my edit to this answer too.
-
Gertlex over 2 yearsA key bit I was missing in reading this answer, (after trying my user's crontab with
sudo poweroff
) was that you want to use the root user's crontab, viasudo
. D'oh.