When I run the following command, I get the expected output but the program does not terminate immediately.
$ mpirun -np 2 echo 1
1
1
The program does not respond to interrupts either. Only after a minute or so I get back to the shell.
Or differently put: the program mpirun -np 2 echo 1; echo 'done' runs successfully but takes forever.
Update:
I ran strace mpirun -np 2 echo 1
The program hangs here:
sysinfo({uptime=5064793, loads=[153856, 184128, 229600], totalram=67362279424, freeram=26006364160, sharedram=8040448, bufferram=1739857920, totalswap=34359734272, freeswap=34358018048, procs=309, totalhigh=0, freehigh=0, mem_unit=1}) = 0
uname({sysname="Linux", nodename="euler", ...}) = 0
ioctl(13, _IOC(0, 0, 0x25, 0)
and then here:
openat(AT_FDCWD, "/tmp/openmpi-sessions-216211#euler_0/42701", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOENT (No such file or directory)
munmap(0x7f61ed88c000, 2127408) = 0
munmap(0x7f61ee0a1000, 2101720) = 0
close(9) = 0
munmap(0x7f61ede9e000, 2105664) = 0
munmap(0x7f61ed685000, 2122480) = 0
munmap(0x7f61eda95000, 2109856) = 0
munmap(0x7f61ed47c000, 2130304) = 0
munmap(0x7f61ed05b000, 2109896) = 0
munmap(0x7f61ecc9a000, 3934648) = 0
munmap(0x7f61ed25f000, 2212016) = 0
munmap(0x7f61ec8e3000, 3894144) = 0
munmap(0x7f61ec6bd000, 2248968) = 0
munmap(0x7f61ea776000, 28999696) = 0
munmap(0x7f61edc99000, 2110072) = 0
exit_group(0) = ?
Could you help me debug this further?
Apparently, the NVIDIA driver was broken. Updating the driver to 440.64.00 resolved the issue.
Related
I want schedule the cron job on every Monday and Thursday at 1.00 AM. I have used below command but I am getting an error.
0 1 * * Mon,Thu /home/abc/xyz.ksh
crontab: error on previous line; unexpected character found in line.
crontab: errors detected in input, no crontab file generated.
Can anyone advise me how to set it up?
Please try this instead:
0 1 * * 1,2 /home/abc/xyz.ksh >/dev/null 2>&1
Regards
0 1 * * 1,4 /home/abc/xyz.ksh >/dev/null 2>&1
Where 1 and 4 translates to Monday and Thursday respectively. Valid range is 0 to 6 with 0 being Sunday and 6 representing Saturday
I try to show tail of a text file. If file is small, there is no difference. However if file is too big (~5 gB), tailf does not respond. On the other hand tail -f works fine. What is difference between them?
I have faced the same issue. The log file was about 47GB. The tailf just waits almost infinite. But the tail -f begin to print the output within seconds.
I have digged deeper by examining the underlying system calls using strace command. The results given below:
# strace tailf /var/log/messages
(truncated)
stat("/var/log/messages", {st_mode=S_IFREG|0600, st_size=47432599401, ...}) = 0
open("/var/log/messages", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=47432600425, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f7dba2d1000
read(3, "Nov 1 03:23:01 hostnameXXXX"..., 4096) = 4096
read(3, "0.31.148.12)\nNov 1 03:54:33 del"..., 4096) = 4096
read(3, "io.c(600) [receiver=3.0.6]\nNov "..., 4096) = 4096
(truncated)
As you can see, the tailf is trying to read (buffer) all the lines from beginning before generating output to the screen.
Check the output of tail -f below, here it is using the system call lseek (C/C++) to directly jump to end of file and start reading from there:
# strace tail -f /var/log/messages
(truncated)
open("/var/log/messages", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0600, st_size=47294167448, ...}) = 0
lseek(3, 0, SEEK_CUR) = 0
lseek(3, 0, SEEK_END) = 47294170917
lseek(3, 47294169088, SEEK_SET) = 47294169088
(truncated)
From the man page:
tailf will print out the last 10 lines of a file and then wait for the
file to grow. It is similar to tail -f but does not access the file
when it is not growing. This has the side effect of not updating the
access time for the file, so a filesystem flush does not occur periodi-
cally when no log activity is happening.
http://linuxcommand.org/man_pages/tailf1.html
If it doesn't access the file directly it will have some difficulties with very lage files, depending on your machines setup.
In Flex AIR application, I would like to upload file to ftp-server with NativeProcess API and curl.
Here is the simplified code:
protected function startProcess(event:MouseEvent):void
{
var processInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
processInfo.executable = new File('/usr/bin/curl');
var processArgs:Vector.<String> = new Vector.<String>();
processArgs.push("-T");
processArgs.push("/Users/UserName/Desktop/001.mov");
processArgs.push("ftp://domainIp//www/site.com/");
processArgs.push("--user");
processArgs.push("username:password");
processInfo.arguments = processArgs;
var process:NativeProcess = new NativeProcess();
process.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, outputDataHandler);
process.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, errorOutputDataHandler);
process.start(processInfo);
}
It does the job well (i.e. target file is uploaded), but it emits ProgressEvent.STANDARD_ERROR_DATA instead of ProgressEvent.STANDARD_OUTPUT_DATA and all progress data goes to process.standardError.
protected function errorOutputDataHandler(event:ProgressEvent):void
{
var process = event.currentTarget as NativeProcess;
trace(process.standardError.readUTFBytes(process.standardError.bytesAvailable));
}
Here is an output of the latter function:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
1 15.8M 0 0 1 200k 0 166k 0:01:37 0:00:01 0:01:36 177k
2 15.8M 0 0 2 381k 0 143k 0:01:53 0:00:02 0:01:51 146k
...
What's wrong with my code? How can I debug it?
Thanks.
What you see is curl's progress meter. Try the -sS option to disable it but keep error messages.
I can use 'r' to get the info of CPU register FLAG.
1.Can I understand by this?
eflags 0x00000082: id vip vif ac vm rf nt IOPL=0 of df if tf SF zf af pf cf
0x00000082= 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0
2.How to change the FLAG? By 'set' command?
<bochs:5> set eflags=0x03
:5: syntax error at 'eflags'
Thank you~
If the flag name is in capitals, then the flag is set. E.g. 'SF' means that sign flag is set, while 'sf' means it is not set. Did you mean this, or something else in your question?
The bochs manual says: "Currently only general purpose registers are supported, you may not change: eflags, eip, cs, ss, ds, es, fs, gs" (http://bochs.sourceforge.net/doc/docbook/user/internal-debugger.html#AEN3098).
Regards
Does anyone know the api for adding users and groups in unix and removing them ? I want to do this programatically.
Thanks,
Frank
I started looking at some system calls and found the following. Note that they are of varying standards, so not all may work on your Unix version:
getpwent
setpwent
putpwent
These however, all assume a password file. Out of curiosity, I straced useradd to find out what he did. Here's a small section of it's output:
# grep -E 'passwd|shadow' useradd.log.20283
...
open("/etc/shadow", O_RDONLY|O_CLOEXEC) = 3
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
open("/etc/passwd.20283", O_WRONLY|O_CREAT|O_EXCL, 0600) = 4
link("/etc/passwd.20283", "/etc/passwd.lock") = 0
stat("/etc/passwd.20283", {st_mode=S_IFREG|0600, st_size=6, ...}) = 0
unlink("/etc/passwd.20283") = 0
open("/etc/passwd", O_RDWR) = 4
open("/etc/shadow.20283", O_WRONLY|O_CREAT|O_EXCL, 0600) = 5
link("/etc/shadow.20283", "/etc/shadow.lock") = 0
stat("/etc/shadow.20283", {st_mode=S_IFREG|0600, st_size=6, ...}) = 0
unlink("/etc/shadow.20283") = 0
open("/etc/shadow", O_RDWR) = 5
open("/etc/gshadow.20283", O_WRONLY|O_CREAT|O_EXCL, 0600) = 7
link("/etc/gshadow.20283", "/etc/gshadow.lock") = 0
stat("/etc/gshadow.20283", {st_mode=S_IFREG|0600, st_size=6, ...}) = 0
unlink("/etc/gshadow.20283") = 0
open("/etc/gshadow", O_RDWR) = 7
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 8
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 9
open("/etc/passwd-", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 9
utime("/etc/passwd-", [2010/09/02-07:07:34, 2010/09/02-07:07:34]) = 0
open("/etc/passwd+", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
lstat("/etc/passwd", {st_mode=S_IFREG|0644, st_size=2479, ...}) = 0
rename("/etc/passwd+", "/etc/passwd") = 0
open("/etc/shadow-", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
utime("/etc/shadow-", [2010/09/02-07:07:34, 2010/09/02-07:07:34]) = 0
open("/etc/shadow+", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
lstat("/etc/shadow", {st_mode=S_IFREG|0600, st_size=1429, ...}) = 0
r ename("/etc/shadow+", "/etc/shadow") = 0
open("/etc/gshadow-", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
utime("/etc/gshadow-", [2010/09/02-07:07:34, 2010/09/02-07:07:34]) = 0
open("/etc/gshadow+", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
lstat("/etc/gshadow", {st_mode=S_IFREG|0400, st_size=1069, ...}) = 0
rename("/etc/gshadow+", "/etc/gshadow") = 0
unlink("/etc/shadow.lock") = 0
unlink("/etc/passwd.lock") = 0
unlink("/etc/gshadow.lock") = 0
Although you get a better idea what's going on with the full context, note that it links a temporary file it created (/etc/passwd.20283) to /etc/passwd.lock. useradd does similarly with the shadow, and gshadow files as well.
It's also important to note that useradd made four calls out to nscd. Two of these were for passwd, and two were for group:
execve("/usr/sbin/nscd", ["/usr/sbin/nscd", "nscd", "-i", "passwd"], [/* 0 vars */]) = 0
If there isn't an API (and I can't seem to find one), it may be because there's many more ways to store users than simple passwd files. Indeed, it's possible that the machine has no control at all over the users.
EDIT: I suppose it's also important to note that useradd consulted /etc/nsswitch.conf as well, likely to verify the origin of the user database. Furthermore, userdel behaved almost identically, creating similarly named temporary and lock files.
I tested under Linux using the following command:
strace -o useradd.log -f -ff -s 1024 useradd tempuser
strace may also appear as truss and ktrace on other unix systems.
I found this question while looking for a way to list all groups on a Unix.
But to create and delete users you can programatically call the utility programs useradd, userdel, groupadd, groupdel since you would know the user name been sent. But I guess you will need superuser rights to invoke them. Anyway you can check the process exit code for command status.
useradd xxx // status zero operation completed
useradd xxx // status nine user already exists
Hope it helps.