set_com_err_hook(dcm_com_err_hook);
/* if /etc/nodcm exists, punt quietly. */
- if (!access("/etc/nodcm", F_OK)) {
+ if (!access(NODCMFILE, F_OK)) {
exit(1);
}
*p = tolower(*p);
com_err(whoami, 0, "checking %s...", service);
qargv[0] = service;
- sprintf(dfgen_prog, "%s/bin/%s.gen", SMS_DIR, service);
+ sprintf(dfgen_prog, "%s/%s.gen", BIN_DIR, service);
if (!file_exists(dfgen_prog)) {
com_err(whoami, 0, "prog %s doesn't exist\n", dfgen_prog);
free(service);
continue;
}
- sprintf(dfgen_cmd, "exec %s %s/dcm/%s.out",
- dfgen_prog, SMS_DIR, service);
+ sprintf(dfgen_cmd, "exec %s %s/%s.out",
+ dfgen_prog, DCM_DIR, service);
gettimeofday(&tv, &tz);
if (status = sms_query("get_server_info", 1, qargv, getsvinfo, &svc)) {
com_err(whoami, status, " getting service %s info, skipping to next service", service);
qargv[5] = strsave(svc.errmsg);
if (svc.interval != 0) {
if (svc.interval * 60 + svc.dfcheck < tv.tv_sec) {
- lock_fd = maybe_lock_update(SMS_DIR, "@db@", service, 1);
+ lock_fd = maybe_lock_update("@db@", service, 1);
if (lock_fd < 0)
goto free_service;
free(qargv[3]);
ex = 1;
else
ex = 0;
- lock_fd = maybe_lock_update(SMS_DIR, "@db@", service, ex);
+ lock_fd = maybe_lock_update("@db@", service, ex);
if (lock_fd >= 0) {
do_hosts(&svc);
close(lock_fd);
goto free_mach;
}
- lock_fd = maybe_lock_update(SMS_DIR, machine, svc->service, 1);
+ lock_fd = maybe_lock_update(machine, svc->service, 1);
if (lock_fd < 0)
goto free_mach;
argv[0] = svc->service;
#include <sys/file.h>
#include <zephyr/zephyr.h>
#include <sms.h>
+#include <sms_app.h>
#include "dcm.h"
}
-int maybe_lock_update(dir, host, service, exclusive)
-char *dir, *host, *service;
+int maybe_lock_update(host, service, exclusive)
+char *host, *service;
int exclusive;
{
char lock[BUFSIZ];
int fd;
- sprintf(lock, "%s/dcm/locks/%s.%s", dir, host, service);
+ sprintf(lock, "%s/%s.%s", LOCK_DIR, host, service);
if ((fd = open(lock, O_TRUNC | O_CREAT, 0)) < 0)
com_err(whoami, errno, ": maybe_lock_update: opening %s", lock);
else if (flock(fd, (exclusive ? LOCK_EX : LOCK_SH) | LOCK_NB) != 0) {
#include <ctype.h>
-#define HESIOD_DIR "/u1/sms/dcm/hesiod"
+char hesiod_dir[64];
#define min(x,y) ((x) < (y) ? (x) : (y))
struct hash *machines = NULL;
IIseterr(ingerr);
initialize_sms_error_table ();
+ sprintf(hesiod_dir, "%s/hesiod", DCM_DIR);
## ingres sms
## set lockmode session where level = table
if (argc == 2) {
fprintf(stderr, "Building tar file.\n");
- sprintf(cmd, "cd %s; tar cf %s .", HESIOD_DIR, argv[1]);
+ sprintf(cmd, "cd %s; tar cf %s .", hesiod_dir, argv[1]);
if (system(cmd))
exit(SMS_TAR_FAIL);
}
## char nn[17], ptype[9];
## int uid, flag1, flag2, id, pid;
- sprintf(poutf, "%s/passwd.db", HESIOD_DIR);
- sprintf(uoutf, "%s/uid.db", HESIOD_DIR);
- sprintf(boutf, "%s/pobox.db", HESIOD_DIR);
+ sprintf(poutf, "%s/passwd.db", hesiod_dir);
+ sprintf(uoutf, "%s/uid.db", hesiod_dir);
+ sprintf(boutf, "%s/pobox.db", hesiod_dir);
if (stat(poutf, &psb) == 0 && stat(uoutf, &usb) == 0 &&
stat(boutf, &bsb) == 0) {
## int gid, id, lid, flag1, flag2, flag3, maxid;
/* open files */
- sprintf(ioutf, "%s/gid.db", HESIOD_DIR);
- sprintf(goutf, "%s/group.db", HESIOD_DIR);
- sprintf(loutf, "%s/grplist.db", HESIOD_DIR);
+ sprintf(ioutf, "%s/gid.db", hesiod_dir);
+ sprintf(goutf, "%s/group.db", hesiod_dir);
+ sprintf(loutf, "%s/grplist.db", hesiod_dir);
if (stat(ioutf, &isb) == 0 && stat(goutf, &gsb) == 0 && stat(loutf, &lsb) == 0) {
ftime = min(isb.st_mtime, min(gsb.st_mtime, lsb.st_mtime));
## int flag1, flag2, flag3, flag4, id, fid;
char *index();
- sprintf(outf, "%s/filsys.db", HESIOD_DIR);
+ sprintf(outf, "%s/filsys.db", hesiod_dir);
if (stat(outf, &sb) == 0) {
ftime = sb.st_mtime;
## char name[33], label[17], data[33], *filetime;
set_mask **machs, *ms, *ps;
- sprintf(outf, "%s/cluster.db", HESIOD_DIR);
+ sprintf(outf, "%s/cluster.db", hesiod_dir);
if (stat(outf, &sb) == 0) {
ftime = sb.st_mtime;
## char name[17], rp[17], sd[33], rm[33], *filetime;
## int flag;
- sprintf(outf, "%s/printcap.db", HESIOD_DIR);
+ sprintf(outf, "%s/printcap.db", hesiod_dir);
if (stat(outf, &sb) == 0) {
ftime = sb.st_mtime;
## char name[33], rm[33], trans[129], *filetime;
## int flag, flag1, ident;
- sprintf(outf, "%s/palladium.db", HESIOD_DIR);
+ sprintf(outf, "%s/palladium.db", hesiod_dir);
if (stat(outf, &sb) == 0) {
ftime = sb.st_mtime;
## char service[17], *filetime;
## int port, flag1, flag2, id;
- sprintf(outf, "%s/sloc.db", HESIOD_DIR);
+ sprintf(outf, "%s/sloc.db", hesiod_dir);
if (stat(outf, &sb) == 0) {
ftime = sb.st_mtime;
## char mach[33], service[33], protocol[9], altserv[129], *filetime;
## int port, flag1, flag2;
- sprintf(outf, "%s/service.db", HESIOD_DIR);
+ sprintf(outf, "%s/service.db", hesiod_dir);
if (stat(outf, &sb) == 0) {
ftime = sb.st_mtime;
#include <sys/stat.h>
#include <sys/time.h>
-#undef NFS_DIR
-#define NFS_DIR "/u1/sms/dcm/nfs"
#define min(x,y) ((x) < (y) ? (x) : (y))
char *whoami = "nfs.gen";
char *malloc(), *strsave();
char *ingres_date_and_time(), *ingres_time(), *ingres_date();
+char nfs_dir[64];
main(argc, argv)
int argc;
IIseterr(ingerr);
initialize_sms_error_table();
+ sprintf(nfs_dir, "%s/nfs", DCM_DIR);
+
## ingres sms
## set lockmode session where level = table
}
if (argc == 2) {
- sprintf(cmd, "cd %s; cp /u1/sms/nfs/* .; tar cf %s .", NFS_DIR, argv[1]);
+ sprintf(cmd, "cd %s; cp %s/nfs/* .; tar cf %s .",
+ nfs_dir, SMS_DIR, argv[1]);
if (system(cmd))
exit(SMS_TAR_FAIL);
}
## char *listname, *lsname, lname[33], uname[9], *filetime;
## int uid, id, flag1, flag2, flag3, flag4;
- sprintf(file, "%s/list-", NFS_DIR);
+ sprintf(file, "%s/list-", nfs_dir);
if (stat(file, &sb) == 0) {
filetime = ingres_date_and_time(sb.st_mtime);
## retrieve (flag1 = int4(interval("min", tblstats.modtime - filetime)))
while (sq_get_data(lists, &listname)) {
if (strlen(listname) == 0)
continue;
- sprintf(file, "%s/list-%s", NFS_DIR, listname);
+ sprintf(file, "%s/list-%s", nfs_dir, listname);
fd = fopen(file, "w");
if (!fd) {
fprintf(stderr, "cannot open %s for output\n", file);
struct save_queue *sq;
fprintf(stderr, "Building the list of everybody\n");
- sprintf(buf, "%s/list-", NFS_DIR);
+ sprintf(buf, "%s/list-", nfs_dir);
fd = fopen(buf, "w");
if (!fd) {
fprintf(stderr, "cannot open %s for output\n", buf);
struct save_queue *sq;
/*
- sprintf(file, "%s/list-", NFS_DIR);
+ sprintf(file, "%s/list-", nfs_dir);
if (stat(file, &sb) == 0) {
filetime = ingres_date_and_time(sb.st_mtime);
# retrieve (flag1 = int4(interval("min", tblstats.modtime - filetime)))
## repeat retrieve (listname = trim(s.value3))
## where s.mach_id = m.mach_id and m.name = @machname
strtrim(machname);
- sprintf(f1, "%s/list-%s", NFS_DIR, listname);
- sprintf(f2, "%s/%s.cred", NFS_DIR, machname);
+ sprintf(f1, "%s/list-%s", nfs_dir, listname);
+ sprintf(f2, "%s/%s.cred", nfs_dir, machname);
unlink(f2); /* ignore errors on this unlink */
if (link(f1, f2)) {
fprintf(stderr, "Cannot link %s to %s\n", f1, f2);
## repeat retrieve (id = n.nfsphys_id) where n.mach_id = m.mach_id and
## m.#name = @machname and n.#device = @device
while (cp = index(device, '/')) *cp = '@';
- sprintf(file, "%s/%s.%s.quotas", NFS_DIR, machname, device);
+ sprintf(file, "%s/%s.%s.quotas", nfs_dir, machname, device);
fd = fopen(file, "w");
if (!fd) {
fprintf(stderr, "cannot open %s for output\n", file);
fprintf(stderr, "error closing %s", file);
exit(SMS_CCONFIG);
}
- sprintf(file, "%s/%s.%s.dirs", NFS_DIR, machname, device);
+ sprintf(file, "%s/%s.%s.dirs", nfs_dir, machname, device);
fd = fopen(file, "w");
if (!fd) {
fprintf(stderr, "cannot open %s for output\n", file);
for (c = cache; c; c = c->next) {
if (!strcmp(c->table, argv[1])) {
- sprintf(prog, "/u1/sms/bin/%s.incr", c->service);
+ sprintf(prog, "%s/%s.incr", BIN_DIR, c->service);
#ifdef DEBUG
com_err(whoami, 0, "forking %s", prog);
#endif
client *cl;
{
register int pid, status;
+ char prog[128];
if (status = check_query_access(&pseudo_query, 0, cl))
return(status);
+ sprintf(prog, "%s/startdcm", BIN_DIR);
pid = vfork();
switch (pid) {
case 0:
- execl("/u1/sms/bin/startdcm", "startdcm", 0);
+ execl(prog, "startdcm", 0);
exit(1);
case -1:
extern char *takedown;
extern int errno;
extern FILE *journal;
-#define JOURNAL "/u1/sms/journal"
extern char *malloc();
extern int free();
client *cl;
{
register int pid;
-
+ char prog[128];
+
cl->reply.sms_argc = 0;
if (cl->reply.sms_status = check_query_access(&pseudo_query, 0, cl) )
return(cl->reply.sms_status);
+ sprintf(prog, "%s/startdcm", BIN_DIR);
pid = vfork();
switch (pid) {
case 0:
for (dummy0 = getdtablesize() - 1; dummy0 > 2; dummy0--)
close(dummy0);
- execl("/u1/sms/bin/startdcm", "startdcm", 0);
+ execl(prog, "startdcm", 0);
exit(1);
case -1:
#include <sys/socket.h>
#include <netinet/in.h>
#include "sms_proto.h"
+#include <sms_app.h>
#include <krb.h>
typedef struct returned_tuples {
#define GROGGY 3
extern int dormant;
-/* If the motd file exists, the server will go to sleep. */
-#define SMS_MOTD_FILE "/etc/smsdown"