diff options
author | 2014-03-22 19:05:38 +0000 | |
---|---|---|
committer | 2014-03-22 19:05:38 +0000 | |
commit | 0e2fea57e4103239235c6d2df5b407671e420322 (patch) | |
tree | 01151ee8547b2cefe0f8c9f1c1aee150f37ec4b1 /dev-util/lockrun | |
parent | New ebuild for app-admin/mate-system-tools, tools aimed to make easy the admi... (diff) | |
download | historical-0e2fea57e4103239235c6d2df5b407671e420322.tar.gz historical-0e2fea57e4103239235c6d2df5b407671e420322.tar.bz2 historical-0e2fea57e4103239235c6d2df5b407671e420322.zip |
Remove old.
Package-Manager: portage-2.2.8-r1/cvs/Linux x86_64
Manifest-Sign-Key: 0x06B1F38DCA45A1EC!
Diffstat (limited to 'dev-util/lockrun')
-rw-r--r-- | dev-util/lockrun/ChangeLog | 9 | ||||
-rw-r--r-- | dev-util/lockrun/Manifest | 25 | ||||
-rw-r--r-- | dev-util/lockrun/files/lockrun.c | 275 | ||||
-rw-r--r-- | dev-util/lockrun/lockrun-2.ebuild | 32 |
4 files changed, 28 insertions, 313 deletions
diff --git a/dev-util/lockrun/ChangeLog b/dev-util/lockrun/ChangeLog index ff862a64caec..45f45726c866 100644 --- a/dev-util/lockrun/ChangeLog +++ b/dev-util/lockrun/ChangeLog @@ -1,6 +1,10 @@ # ChangeLog for dev-util/lockrun -# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-util/lockrun/ChangeLog,v 1.13 2012/07/03 20:30:35 jer Exp $ +# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-util/lockrun/ChangeLog,v 1.14 2014/03/22 19:01:35 kensington Exp $ + + 22 Mar 2014; Michael Palimaka <kensington@gentoo.org> -files/lockrun.c, + -lockrun-2.ebuild: + Remove old. 03 Jul 2012; Jeroen Roovers <jer@gentoo.org> lockrun-20120508.ebuild: Stable for HPPA (bug #422075). @@ -46,4 +50,3 @@ 05 Feb 2008; Caleb Tennis <caleb@gentoo.org> +files/lockrun.c, +metadata.xml, +lockrun-2.ebuild: Initial import - diff --git a/dev-util/lockrun/Manifest b/dev-util/lockrun/Manifest index 9e2e97ad6347..1605ceb07689 100644 --- a/dev-util/lockrun/Manifest +++ b/dev-util/lockrun/Manifest @@ -1,6 +1,25 @@ -AUX lockrun.c 6575 SHA256 a334776691c0e0c7ceea0ea78bac9124ab9df176797cd77cda95a1307065e715 SHA512 8e273c357b18cf893c5ef181716ab62a023791185cadaa49fc473577d575cb2a0a435cb7878223c9e1105af64180f0ec3622b261df7760bd55d28b58f909741d WHIRLPOOL e9829b2c060cbc141b07500acbf04fa56904ea9128aa3380614e9fff6429a872226118f3f8f2286ecbca3c32f2e3cb733b883d2bad9299071bf139631c5983ca +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA256 + AUX lockrun.c-20120508 7021 SHA256 e9e60ae24c52875332d775a94f1fe188f7cf0d95b2de9e728f83dec693aba44d SHA512 7db0e2ac35dd3a88625fdb88d35b3ef9c1a0820439f05bcb4ee028a698e1a47b58c439a4f0b603cf88873a8120300b8fa5633d429ccf8c95fd5927d04448a1dd WHIRLPOOL fce3d2c1974eb32b4a0c9ff108012babecfc1538ba9f9f5f120b313716f8b093481516478fde1f105c93183db1ecf5161142708349659b034de4270883b96957 -EBUILD lockrun-2.ebuild 649 SHA256 853cbedcc882d9cdb5d743890ebe531413d15f17ce1fac7214c7cc05c1171600 SHA512 c8e22136f68d2c597638238cfc5c4f630330002d1055ea31475aea66b25c822fdaaab648e6b803471aad5d929e5c876bc966d8b514e1cad98128b6caf3e68753 WHIRLPOOL de2f4508fc78b608176d155d7960301d63e19847a50a36e66d0a2bf354950c650c2b0cd3dcec3889aafc2d7adc4a7c9c04c01e70bdf4367b32806d614c5c1947 EBUILD lockrun-20120508.ebuild 711 SHA256 9a8e5c33f0d480625dad169f3384a55fe0e4433bc2da00d3f429b6cf15f904b8 SHA512 4186b12f0b9d72253b85bcb7904e320c6c225a97724ad8e67b37425f8cb680be6bba8bc5c914deb54c6809ac6ceee8a2ab98bb84a7b101cbccadd4cecc4aa407 WHIRLPOOL 1dbf3cec5585829ecface36673643986c9f756462122b4c22ede67f37ae1d48aac1ee7af5d0ddae576bfefc10c962ace8a5217813401fd6af881b10316cf8a11 -MISC ChangeLog 1690 SHA256 54dbc999d5fca5f557442e466ba19a9b13b594f7e0f3da4c1f8e97fbb3743014 SHA512 dca6db9fed624942af1884cb27466130bc1dba23a7ebe1e0b46d8b20d3913a8f3e2d001d9c94c27ec6bb4b086ffe51c1e571884505fb092ad0f1d086f068de61 WHIRLPOOL d9d809ee696621c7d98309b05e451bfc8cedea00a2c77e45560be493565287e407ea095d32490703119a96c28b6a12607d4b1d4ab0141ec2e4024eb101ca0e70 +MISC ChangeLog 1806 SHA256 9f4fc194618cb2adc547ab90fc283426f4d2dc57d1ec41f03f19f38cff8dcf25 SHA512 d58392101eedfc6593daa3938534e0ff42fd43f60d384d3cbba7464de6364aab9802232bcd0f2b62479eb051de5ca47c8a9d74049e32f18c95af36e0abe38d2d WHIRLPOOL 28e49ba6424cb80560afd7c145312379a4de056007b1696052f08f7e37a08a3bdb0bfefba6065a11bd6556f760fe99906f1ad6b9e472ac2a3edb098ddfe2e1a5 MISC metadata.xml 211 SHA256 84ff2341253cdd21a6782e14ebc076a8bcae11428aacfe2454f4b32165504727 SHA512 a9385b7dc02a9537080a9b1bf59ae2caacd84cab2e3ef1fee15e4f10d5518ae9f71e4ce07d99104e643d18a79ca05116d74e97ec7d230d21b340656701547078 WHIRLPOOL 4309ff085fbfd1a91434c0a9dd4c23b7ad8b10b0559beedcb4d911745543745691abe91bb1e361dd88b6383678f020c95deb9359876319a6407ac0ef2dcbd221 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.22 (GNU/Linux) + +iQJiBAEBCABMBQJTLd4PRRSAAAAAABQAKGlzc3Vlci1mcHJAbm90YXRpb25zOTc5 +MTY5NkQ3RDM3NkRBN0U5QjZGMTUwMDZCMUYzOERDQTQ1QTFFQwAKCRAGsfONykWh +7JUID/98CXWi2NwyagnvHCxWJi9t3A6SPuXq+Q3pnSBCFikHkKxaeYpdzYHwUsSQ +EN1JgAkGnDWTiFhCTY9A4S9+89075P6qBPjcJZdy/dfl3GaHvCrDJlldnTERcFcm +7/ALIClbnbFMf1OPkGG3XtazEDewYpZH6hwVn5U5eQt73lfnciao5QyYJjgiPn+H +0Rbg5964CxFPlTnq4v3KiVR/H9ypMewmUO7xu2+7u/tNjDcGcBOVbfhRxaQKqX3s +Qv+FZw4/u+7xgpxDSHwofxqgJjCZ9QDucqUZSUS8orijeVXt03ocF87rdCpcJAvE +P68xb/tNdxP6S6vN36E2PP+GPWrTVDqmowo/NFWUqWIqOTbeoCutkVKT3Fmg/9Ac +WtkzKqEJMx9I36aMdvryL9buaf/wIpDnUVmxqKb1pmF1othNJhWDhH6pp6wyMqWB +APrUwvyNvZ5Ie0UqyCh8KMNphfuI0pSg9nauMoVjMGNblQTf8HgAova0Jr2DXsQF +SsEZJevx6yz3ItyZATXDuVSFVt577opwvgul1dRTGYc3140oqZLiDSONNJ8gYfws +R3gaTUiwxaH3bUHLbMRfkK6bYiMe5DEoxwqb1LTB/pB8J5rssddJotseuesAF7le +hHifKAOaWt62wWQdKjS/C8gcv9PdncXAejPiPNWmCZJuYtdw3A== +=ma7j +-----END PGP SIGNATURE----- diff --git a/dev-util/lockrun/files/lockrun.c b/dev-util/lockrun/files/lockrun.c deleted file mode 100644 index bccc0db7bcb7..000000000000 --- a/dev-util/lockrun/files/lockrun.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * $Id: lockrun.c,v 1.1 2008/02/05 18:22:38 caleb Exp $ - * - * written by : Stephen J. Friedl - * Software Consultant - * steve@unixwiz.net - * http://www.unixwiz.net/tools/ - * - * =================================================================== - * ======== This software is in the public domain, and can be ======== - * ======== used by anybody for any purpose ======== - * =================================================================== - * - * Lockrun: This program is used to launch a program out with a lockout - * so that only one can run at a time. It's mainly intended for use out - * of cron so that our five-minute running jobs which run long don't get - * walked on. We find this a *lot* with Cacti jobs which just get hung - * up: it's better to miss a polling period than to stack them up and - * slow each other down. - * - * So we use a file which is used for locking: this program attempts to - * lock the file, and if the lock exists, we have to either exit with - * an error, or wait for it to release. - * - * lockrun --lockfile=FILE -- my command here - * - * COMMAND LINE - * ------------ - * - * --lockfile=F - * - * Specify the name of a file which is used for locking. The file is - * created if necessary (with mode 0666), and no I/O of any kind is - * done. The file is never removed. - * - * --maxtime=N - * - * The script being controlled should run for no more than <N> seconds, - * and if it's beyond that time, we should report it to the standard - * error (which probably gets routed to the user via cron's email). - * - * --wait - * - * When a lock is hit, we normally exit with error, but --wait causes - * it to loop until the lock is released. - * - * --verbose - * - * Show a bit more runtime debugging. - * - * -- - * - * Mark the end of the options: the command to run follows. - * - */ - -#include <stdio.h> -#include <stdarg.h> -#include <errno.h> -#include <stdlib.h> -#include <string.h> -#include <fcntl.h> -#include <unistd.h> -#include <time.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <sys/file.h> - -#ifndef __GNUC__ -# define __attribute__(x) /* nothing */ -#endif - - -#define STRMATCH(a,b) (strcmp((a),(b)) == 0) - -#define UNUSED_PARAMETER(v) ((void)(v)) - -#define TRUE 1 -#define FALSE 0 - -static const char *lockfile = 0; -static int wait_for_lock = FALSE; -static mode_t openmode = 0666; -static int sleeptime = 10; /* seconds */ -static int Verbose = FALSE; -static int Maxtime = 0; - -static char *getarg(char *opt, char ***pargv); - -static void die(const char *format, ...) - __attribute__((noreturn)) - __attribute__((format(printf, 1, 2))); - -int main(int argc, char **argv) -{ - char *Argv0 = *argv; - int rc; - int lfd; - pid_t childpid; - time_t starttime; - - UNUSED_PARAMETER(argc); - - time(&starttime); - - for ( argv++ ; *argv ; argv++ ) - { - char *arg = *argv; - char *opt = strchr(arg, '='); - - /* the -- token marks the end of the list */ - - if ( strcmp(*argv, "--") == 0 ) - { - argv++; - break; - } - - if (opt) *opt++ = '\0'; /* pick off the =VALUE part */ - - if ( STRMATCH(arg, "-L") || STRMATCH(arg, "--lockfile")) - { - lockfile = getarg(opt, &argv); - } - - else if ( STRMATCH(arg, "-W") || STRMATCH(arg, "--wait")) - { - wait_for_lock = TRUE; - } - - else if ( STRMATCH(arg, "-S") || STRMATCH(arg, "--sleep")) - { - sleeptime = atoi(getarg(opt, &argv)); - } - - else if ( STRMATCH(arg, "-T") || STRMATCH(arg, "--maxtime")) - { - Maxtime = atoi(getarg(opt, &argv)); - } - - else if ( STRMATCH(arg, "-V") || STRMATCH(arg, "--verbose")) - { - Verbose++; - } - - else - { - die("ERROR: \"%s\" is an invalid cmdline param", arg); - } - } - - /*---------------------------------------------------------------- - * SANITY CHECKING - * - * Make sure that we have all the parameters we require - */ - if (*argv == 0) - die("ERROR: missing command to %s (must follow \"--\" marker) ", Argv0); - - if (lockfile == 0) - die("ERROR: missing --lockfile=F parameter"); - - /*---------------------------------------------------------------- - * Open or create the lockfile, then try to acquire the lock. If - * the lock is acquired immediately (==0), then we're done, but - * if the lock is not available, we have to wait for it. - * - * We can either loop trying for the lock (for --wait), or exit - * with error. - */ - - if ( (lfd = open(lockfile, O_RDWR|O_CREAT, openmode)) < 0) - die("ERROR: cannot open(%s) [err=%s]", lockfile, strerror(errno)); - - while ( flock(lfd, LOCK_EX | LOCK_NB) != 0 ) - { - if ( ! wait_for_lock ) - { - die("ERROR: cannot launch %s - run is locked", argv[0]); - } - - /* waiting */ - if ( Verbose ) printf("(locked: sleeping %d secs)\n", sleeptime); - - sleep(sleeptime); - } - - fflush(stdout); - - /* run the child */ - - - if ( (childpid = fork()) == 0 ) - { - close(lfd); // don't need the lock file - - execvp(argv[0], argv); - } - else if ( childpid > 0 ) - { - time_t endtime; - pid_t pid; - - if ( Verbose ) - printf("Waiting for process %ld\n", (long) childpid); - - pid = waitpid(childpid, &rc, 0); - - time(&endtime); - - endtime -= starttime; - - if ( Verbose || (Maxtime > 0 && endtime > Maxtime) ) - printf("pid %d exited with status %d (time=%ld sec)\n", pid, rc, endtime); - } - else - { - die("ERROR: cannot fork [%s]", strerror(errno)); - } - - exit(rc); -} - - -/*! \fn static char *getarg(char *opt, char ***pargv) - * \brief A function to parse calling parameters - * - * This is a helper for the main arg-processing loop: we work with - * options which are either of the form "-X=FOO" or "-X FOO"; we - * want an easy way to handle either one. - * - * The idea is that if the parameter has an = sign, we use the rest - * of that same argv[X] string, otherwise we have to get the *next* - * argv[X] string. But it's an error if an option-requiring param - * is at the end of the list with no argument to follow. - * - * The option name could be of the form "-C" or "--conf", but we - * grab it from the existing argv[] so we can report it well. - * - * \return character pointer to the argument - * - */ -static char *getarg(char *opt, char ***pargv) -{ - const char *const optname = **pargv; - - /* option already set? */ - if (opt) return opt; - - /* advance to next argv[] and try that one */ - if ((opt = *++(*pargv)) == 0) - die("ERROR: option %s requires a parameter", optname); - - return opt; -} - -/* - * die() - * - * Given a printf-style argument list, format it to the standard error, - * append a newline, then exit with error status. - */ - -static void die(const char *format, ...) -{ -va_list args; - - va_start(args, format); - vfprintf(stderr, format, args); - putc('\n', stderr); - va_end(args); - - exit(EXIT_FAILURE); -} - diff --git a/dev-util/lockrun/lockrun-2.ebuild b/dev-util/lockrun/lockrun-2.ebuild deleted file mode 100644 index c5e4e0573d3d..000000000000 --- a/dev-util/lockrun/lockrun-2.ebuild +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 1999-2010 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/dev-util/lockrun/lockrun-2.ebuild,v 1.7 2010/08/11 01:00:23 jer Exp $ - -inherit toolchain-funcs - -DESCRIPTION="Lockrun - runs cronjobs with overrun protection" -HOMEPAGE="http://www.unixwiz.net/tools/lockrun.html" - -LICENSE="public-domain" -SLOT="0" -KEYWORDS="amd64 hppa x86" -IUSE="" - -RESTRICT="test" - -DEPEND="" -RDEPEND="${DEPEND}" - -S="${WORKDIR}" - -src_unpack() { - cp "${FILESDIR}"/lockrun.c "${S}"/lockrun.c -} - -src_compile() { - emake CC=$(tc-getCC) ${PN} || die "make failed" -} - -src_install () { - dobin ${PN} -} |