How do I get a particular log rotated at a custom time on a debian system? - logrotate

On my debian system, I have many logs which are rotated daily through their config files located in the /etc/logrotated.d/ directory.
I need to change the rotation time of a particular log, say backup.log; the rotation config is located in /etc/logrotated.d/backup.conf. I want to get backup.log rotated at 1:00 am, whithout changing the global rotation time.
How can I do it?

It's very simple:
move /etc/logrotated.d/backup.conf to /etc/logrotate_backup.conf
add the following line to /etc/crontab
0 1 * * * root /usr/sbin/logrotate /etc/logrotate_backup.conf
The rotation of backup.log will be activated at 1:00 am.
Alternatively, you can put that line in a custom file in /etc/cron.d/. e.g /etc/cron.d/logrotate_backup.

Related

How to ignore emacs temp files in Jekyll?

I have Jekyll blog and when I run jekyll serve, and I'm editing the post in GNU Emacs I got this output:
Regenerating: 2 file(s) changed at 2020-02-28 09:05:34
_posts/2018-10-20-pytania-rekrutacyjne-css.markdown
_posts/.#2018-10-20-pytania-rekrutacyjne-css.markdown
...done in 13.517243884 seconds.
is it possible to ignore files that starts with .#. I assume it would be twice as fast to generate the html page.
I've tried this:
exclude:
-
README.md
-
.\#*
-
_posts/.\#*
but this don't work, it regenerate when I save _config.yml (as .#_config.yml) the same as with posts.
I would like to ignore every Emacs file in my Jekyll project.
Files with a .# prefix are lockfiles. They prevent separate Emacs instances from editing the same file at the same time. See https://www.gnu.org/software/emacs/manual/html_node/emacs/Interlocking.html. Personally, I set (setq create-lockfiles nil) because I rarely run more than one Emacs, and I have (global-auto-revert-mode 1). auto-revert-mode will watch for a file to be changed and automatically reload it (or tell you it has changed if there are unsaved changes).
Also take a look at https://github.com/emacscollective/no-littering to move autosave and backup files to a common place instead of next to whatever file you're editing.
Probably only the message is confusing. It says 2 files changed, which is correct. It does not say 2 files regenerated. My config does not even exclude .#-files. I get the same message, but no .#-file is generated. Check the _site folder. And check the time to regenerate the output file
touch _posts/2018-10-20-pytania-rekrutacyjne-css.markdown # still around 14 sec?
touch _posts/.#2018-10-20-pytania-rekrutacyjne-css.markdown # should be close to zero?

Matlab and simulink stateflow chart error

I have been trying to use "stateflow chart" block for hours. However, I keep getting this error:
The current directory is c:\program files\matlab13\bin, which is reserved for MATLAB files. Please change your current directory to a writable directory preferably outside of MATLAB installation area.
What I have done:
moved the model from bin to my E:\drive but nothing is going good.
But did you actually change directories. For example typing in the command window:
cd('E:\drive');
You could also change your current directory by changing the current folder from the second menu bar at the top of the Matlab window. If you do it either way, you should be no longer in the Matlab installation area and the first error message should not appear. If things are still not working out, you will have to share the new error message with us.

Extracting thumbnails with mplayer result in grey images

I'm trying to extract thumbnails using mplayer with this command:
mplayer -nosound -ss 1 -vf screenshot -frames 1 -vo png:z=9 jump.mpg
The problem is that it results in an almost grey image.
If I now try and execute the command:
mplayer -ss 1 jump.mpg
Then the video plays back skipping the first second (as expected), but the first second of the playback is mostly grey. Technically, I think it displays the diff to the previous frame, until it gets to a key frame, where the whole frame is encoded in the video.
Now the question is:
How do I force mplayer to seek to a key frame, so I avoid this grey image when extracting?
I found the option -hr-seek off, which sounds like it should do the right thing, but it doesn't.
Just use mplayer2, the seek problem is solved. I tested myself:
http://www.mplayer2.org/differences/
on debian/ubuntu just install via apt-get install mplayer2

How do I profile my emacs configuration?

My emacs configuration takes a very long time to load. How can I easily find the offending parts and optimize them?
Very useful package: http://www.emacswiki.org/emacs/ProfileDotEmacs
Just skip loading your init file and let ProfileDotEmacs load/profile it for you:
emacs -Q -l profile-dotemacs.el -f profile-dotemacs
Another solution is ESUP, the Emacs Start Up Profiler. It can profile your config file without leaving Emacs - it accomplishes this by starting a new Emacs as a child process, getting profile information from it.
By using divide and conquer, of course!
Drop the bottom half of your .emacs. See if the speed improves. (If so, the culprit is within the bottom half; otherwise it's in the top half.) Restore the working half. Chop off half of the broken half, and repeat the process until you have isolated the problem.

Matrix-like Idle Animation for Emacs

As is, my emacs is set up to show green text on a black background. On seeing it, a friend remarked that I just took it because of the Matrix-like appearance it gives. So, now what I want to do is implement an idle animation for it where, like in the matrix, changing text falls down the screen. Like in the zone out functions, it should run after emacs has been idle for a while. How would this be done?
You might want to check out the package zone: M-x zone
The 'zone-pgm-drip is like the Matrix drip, only one character at a time. I'm sure it could be enhanced to be more flood like. Also, the 'zone-pgm-jitter has text flooding down, but it's just the text currently on the screen (so it's horizontal extent is limited to what was already showing). You can just run M-x zone over and over until you find what you like.
If you want to limit the choices zone uses, you can restrict the array that zone uses:
(setq zone-programs [zone-pgm-jitter])
The choices for zone-programs are:
zone-pgm-jitter
zone-pgm-putz-with-case
zone-pgm-dissolve
zone-pgm-explode
zone-pgm-whack-chars
zone-pgm-rotate
zone-pgm-rotate-LR-lockstep
zone-pgm-rotate-RL-lockstep
zone-pgm-rotate-LR-variable
zone-pgm-rotate-RL-variable
zone-pgm-drip
zone-pgm-drip-fretfully
zone-pgm-five-oclock-swan-dive
zone-pgm-martini-swan-dive
zone-pgm-rat-race
zone-pgm-paragraph-spaz
zone-pgm-stress
zone-pgm-stress-destress
zone-pgm-random-life
You could install zone-matrix from Marmalade. "M-x package-install zone-matrix"
Looks like someone just made one. It worked for me after a small amount of tweaking:
https://github.com/emacsmirror/zone-matrix
You could just use the xmatrix screensaver, which could probably be modified to run in a window other than the X root if you really want it to run it within emacs. Bonus points if you can modify it to use glyphs based on the text in the current window. By strange coincidence, Jamie Zawinski both wrote xmatrix and large chunks of Lucid Emacs, which was subsequently released under an open-source licence as Xemacs.