On my mac system , /var/log/system.log is not write until two days ago.
I want it continue to write ,how would I do?
You want to see earlier stuff that was written to system.log? The system log is "rotated". When it gets too big, it is moved aside and compressed. A new system log is created for new log messages. The old logs are kept as /var/log/system.log.0.bz2, system.log.1.bz2, etc. You can uncompress and view them with the sudo bzless command.
The program which performs the rotation of the logs is newsyslog. Its configuration file is newsyslog.conf. It is run on a regular basis by launchd due to the launchd plist file in /System/Library/LaunchDaemons/com.apple.newsyslog.plist.
Related
I have created a sample kext used the below code to write a log.
IOLog("scan\n");
I have loaded kext by running below command in terminal.
sudo kextload mykext.kext
it loaded sucessfully when i check system.log file unable to find logs written in code.
You wont be able to find the log file, because there is no such. You should use log utility in terminal:
sudo log show
The output of this command is huge.
There are some built-in options that could help you to filter, like --last 5m, but I recomend to write all your driver messages with some stable prefix, like "MyDriver:", so you can use the log with | grep MyDriver:
I've recently bought a macbook and I am completely new to the whole Mac environment. I'm trying to recreate some automated processes I had on my old windows laptop. So here's my problem:
I use the terminal to download a file from my Google Cloud Storage using the gsutil command:
gsutil cp gs://<bucket>/<file> <destination>
This works and it gets me what I need. My question is: can I make a file that runs this and other commands through the terminal so that I don't have to open up the terminal every time?
I've tried to use the Automator app but it gets way too complicated because Automator doesn't have the same configurations needed that I have already settled in the terminal. I have also tried making a .bs file containing the following code:
#!/bin/sh
gsutil cp gs://<bucket>/<file> <destination>
But this doesn't help me because it just opens up Xcode when I click this file.
There has to be a simple way to make a file which executes some simple terminal commands right? I feel like I am missing something fundamental about macs and linux in general. If you have any idea how I can tackle this, please let me know.
Thanks in advance!
I have a .jar file that is compiled on a server and is later copied down to a local machine. Doing ls -lon the local machine just gives me the time it was copied down onto the local machine, which could be much later than when it was created on the server. Is there a way to find that time on the command line?
UNIX-like systems do not record file creation time.
Each directory entry has 3 timestamps, all of which can be shown by running the stat command or by providing options to ls -l:
Last modification time (ls -l)
Last access time (ls -lu)
Last status (inode) change time (ls -lc)
For example, if you create a file, wait a few minutes, then update it, read it, and do a chmod to change its permissions, there will be no record in the file system of the time you created it.
If you're careful about how you copy the file to the local machine (for example, using scp -p rather than just scp), you might be able to avoid updating the modification time. I presume that a .jar file probably won't be modified after it's first created, so the modification time might be good enough.
Or, as Etan Reisner suggests in a comment, there might be useful information in the .jar file itself (which is basically a zip file). I don't know enough about .jar files to comment further on that.
wget and curl have options that allow you to preserve the file's modified time stamp. This is close enough to what I was looking for.
I have a background process that I do not want to restart. Its output is actively being logged to a file.
nohup mycommand 1> myoutputfile.log 2>&1 &
I want to "archive" the file the process is currently writing its output to, and make it start writing to a blank file at the same file name. I must be able to do this without having to kill the process and start it again.
I tried simply renaming the existing file (to myoutputfile_.log), hoping that the shell now finding that the file is no longer there, will create a new file with the original file name (myoutputfile.log). But this does not work as the shell holds a reference to the file's location and keeps appending to it.
I looked here. On executing ls, I see that the streams are now marked as (deleted) but I'm quite confused what to do next. In the gdb command, do I have to specify the process executable in addition to the process ID? What happens if I don't specify it or I get it wrong? Once in gdb, how do I force the stream to re-create a file in the deleted file's same location (same path and filename)?
How can I use the commands in shell to signal it to start a new file for an existing process's output redirection?
PS: I can't do a trial-and-error because it's rather important I get this right. If it is relevant to know, this is a java process.
I resolved this issue by doing the following:
cp myoutputfile.log myoutputfile_.log; echo > myoutputfile.log
This essentially reset the log file after copying the original contents to a new file.
I have a Ruby script that I am triggering with an OS X launchagent. The script reads a bunch of files (21 total) from disk, does some processing, compiles them into an RSS feed, and uploads it to a remote machine using scp. The script works fine when I run it from the command line. However, when I run it with a launchagent I run into some very strange issues. I have isolated the problem to this line:
match = #content.match(/(?<=^ID: )\d+/)
#content here refers to the contents of a file, read in earlier. This line is embedded in a class which serially processes each file. Something about this line is somehow causing execution to be dropped-- when I put a log statement after this line, it is triggered only for 16/21 of the files when running as launchagent. When running from the command line, there is no issue.
I also have noticed that these 5 files are almost, but not exactly, the five largest of the 21 files. What could possibly be going on? Any well-known typical issues when working with LaunchAgents?
UPDATE: this is one of the files that is breaking the code.