[Midnightbsd-cvs] src [11377] U trunk/libexec/atrun/atrun.man: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Jul 6 09:55:51 EDT 2018


Revision: 11377
          http://svnweb.midnightbsd.org/src/?rev=11377
Author:   laffer1
Date:     2018-07-06 09:55:50 -0400 (Fri, 06 Jul 2018)
Log Message:
-----------
sync with freebsd

Modified Paths:
--------------
    trunk/libexec/atrun/atrun.c
    trunk/libexec/atrun/atrun.man

Property Changed:
----------------
    trunk/libexec/atrun/LEGAL
    trunk/libexec/atrun/atrun.man

Index: trunk/libexec/atrun/LEGAL
===================================================================
--- trunk/libexec/atrun/LEGAL	2018-07-06 13:54:26 UTC (rev 11376)
+++ trunk/libexec/atrun/LEGAL	2018-07-06 13:55:50 UTC (rev 11377)

Property changes on: trunk/libexec/atrun/LEGAL
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property
Modified: trunk/libexec/atrun/atrun.c
===================================================================
--- trunk/libexec/atrun/atrun.c	2018-07-06 13:54:26 UTC (rev 11376)
+++ trunk/libexec/atrun/atrun.c	2018-07-06 13:55:50 UTC (rev 11377)
@@ -31,6 +31,7 @@
 /* System Headers */
 
 #include <sys/fcntl.h>
+#include <sys/file.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #ifdef __MidnightBSD__
@@ -197,7 +198,7 @@
     PRIV_END
 
     if (stream == NULL)
-	perr("cannot open input file");
+	perr("cannot open input file %s", filename);
 
     if ((fd_in = dup(fileno(stream))) <0)
 	perr("error duplicating input file descriptor");
@@ -458,8 +459,9 @@
     int c;
     int run_batch;
 #ifdef __MidnightBSD__
-    size_t ncpu, ncpusz;
+    size_t ncpusz;
     double load_avg = -1;
+    int ncpu;
 #else
     double load_avg = LOADAVG_MX;
 #endif
@@ -521,6 +523,9 @@
     if ((spool = opendir(".")) == NULL)
 	perr("cannot read %s", ATJOB_DIR);
 
+    if (flock(dirfd(spool), LOCK_EX) == -1)
+	perr("cannot lock %s", ATJOB_DIR);
+
     now = time(NULL);
     run_batch = 0;
     batch_uid = (uid_t) -1;
@@ -563,6 +568,12 @@
     if (run_batch && (gloadavg() < load_avg))
 	run_file(batch_name, batch_uid, batch_gid);
 
+    if (flock(dirfd(spool), LOCK_UN) == -1)
+	perr("cannot unlock %s", ATJOB_DIR);
+
+    if (closedir(spool) == -1)
+	perr("cannot closedir %s", ATJOB_DIR);
+
     closelog();
     exit(EXIT_SUCCESS);
 }

Modified: trunk/libexec/atrun/atrun.man
===================================================================
--- trunk/libexec/atrun/atrun.man	2018-07-06 13:54:26 UTC (rev 11376)
+++ trunk/libexec/atrun/atrun.man	2018-07-06 13:55:50 UTC (rev 11377)
@@ -1,5 +1,6 @@
 .\" $MidnightBSD$
-.Dd November 11, 2014
+.\" $FreeBSD: stable/10/libexec/atrun/atrun.man 284970 2015-06-30 19:53:26Z wblock $
+.Dd June 22, 2015
 .Dt ATRUN 8
 .Os
 .Sh NAME
@@ -14,32 +15,32 @@
 runs jobs queued by
 .Xr at 1 .
 .Pp
-Root's
+The system
 .Xr crontab 5
 file
 .Pa /etc/crontab
-has to contain the line
+must contain the line
 .Bd -literal
 */5     *       *       *       *       root    /usr/libexec/atrun
 .Ed
 .Pp
-so that
+so
 .Nm
-gets invoked every five minutes.
+is invoked every five minutes.
 .Pp
 At every invocation,
 .Nm
-will start all the jobs in the lowercase queues whose start
+starts all the jobs in the lowercase queues whose start
 time has elapsed.
 In addition, if the load average over the last minute was less than
-the specified limit then a maximum of one batch job (denoted by the
+the specified limit, then a maximum of one batch job (denoted by the
 uppercase queues) is started.
 .Pp
 Before starting a job,
 .Nm
-will check the status of its owner's account with
+checks the status of its owner's account with
 .Xr pam 3
-and refuse to run the job if the account is unavailable,
+and refuses to run the job if the account is unavailable,
 e.g., locked out or expired.
 .Sh OPTIONS
 .Bl -tag -width indent
@@ -53,9 +54,11 @@
 .Sh WARNINGS
 For
 .Nm
-to work, you have to start up a
+to work, a
 .Xr cron 8
-daemon.
+daemon must be running
+.Nm
+periodically.
 .Sh FILES
 .Bl -tag -width /etc/pam.d/atrun -compact
 .It Pa /etc/pam.d/atrun


Property changes on: trunk/libexec/atrun/atrun.man
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list