For Debian based distros run the following command as root :
update-rc.d servicename defaults
For CentOS and RedHat run the following command as root :
chkconfig servicename on
For Debian based distros run the following command as root :
update-rc.d servicename defaults
For CentOS and RedHat run the following command as root :
chkconfig servicename on
As a Linux administrator you may need to force logout and kill a specific user, or an active user in pts/0 pts/1 pts/3 etc. Also this tutorial will work in most linux distros.
First of all display the out put of “w” command.
[root@server ~#]w 18:08:30 up 3:54, 3 users, load average: 0.05, 0.02, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root pts/0 192.168.10.100 14:15 0.00s 0.05s 0.01s w james pts/1 192.168.10.100 18:07 50.00s 0.02s 0.02s -bash james pts/2 10.10.20.23 18:07 39.00s 0.02s 0.02s -bash
Here the user “james” is logged in from two different machines. And you need to force logout and kill the user “james” logged in from ip: 192.168.10.100 (pts/1)
use the below command
[root@server ~#]skill -KILL -v pts/1
This command will force logout and kill the user in pts/1. and the same user logged in pts/2 will not be logged out.
If need to kill a users all the connected sessions at once
[root@server ~#]skill -KILL -u james
(this will kill both pts/1 and pts/2 cessions)
To STOP/PAUSE a user’s activities
[root@server ~#]skill -STOP -u james
To RESUME a stopped user
[root@server ~#]skill -CONT -u james
Edit
There is some bug in recent Debian(7) and distros based on them like Ubuntu, which will make the command
skill -KILL -v pts/1
do nothing
What you can do in such case is to get the PID of the terminal you want to kill with
skill -i -t pts/1
it will return something like
pts/1 root 27933 bash ?
Just kill it –
kill 27933
This example widget code, place the code in separate file, then include it in finctions.php like that:
require( get_template_directory() . '/menu-widget.php' );
Register the widget(match the class names!)-
function register_my_widget() {
register_widget( 'example_widget' );
}
And call the widget:
add_action( 'widgets_init', function(){
register_widget( 'My_Widget' );
});
And here it comes the widget code:
<?php
/**
* Example Widget Class
*/
class example_widget extends WP_Widget {
/** constructor -- name this the same as the class above */
function example_widget() {
parent::WP_Widget(false, $name = 'Example Text Widget');
}
/** @see WP_Widget::widget -- do not rename this */
function widget($args, $instance) {
extract( $args );
$title = apply_filters('widget_title', $instance['title']);
$message = $instance['message'];
?>
<?php echo $before_widget; ?>
<?php if ( $title )
echo $before_title . $title . $after_title; ?>
<ul>
<li><?php echo $message; ?></li>
</ul>
<?php echo $after_widget; ?>
<?php
}
/** @see WP_Widget::update -- do not rename this */
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['message'] = strip_tags($new_instance['message']);
return $instance;
}
/** @see WP_Widget::form -- do not rename this */
function form($instance) {
$title = esc_attr($instance['title']);
$message = esc_attr($instance['message']);
?>
<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
</p>
<p>
<label for="<?php echo $this->get_field_id('message'); ?>"><?php _e('Simple Message'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('message'); ?>" name="<?php echo $this->get_field_name('message'); ?>" type="text" value="<?php echo $message; ?>" />
</p>
<?php
}
} // end class example_widget
add_action('widgets_init', create_function('', 'return register_widget("example_widget");'));
?>
You can use ultimate posts widget to display posts – ultimate-posts-widget.1.8.1