Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- *,
- (select count(*) from domains) as count,
- (select 456976-count(*) from domains) as remaining
- from domains
- order by domain desc
- limit 0, 1;
- use mydatabase
- DELIMITER $$
- DROP PROCEDURE IF EXISTS `MyDataStatus` $$
- CREATE PROCEDURE `MyDataStatus` ()
- BEGIN
- SET @SecondsToPause = 10;
- SELECT COUNT(*) INTO @CurrentCount FROM domains;
- SET @Remaining = 456976 - @CurrentCount;
- WHILE @Remaining > 0 DO
- SELECT *,@CurrentCount as `count`,@CurrentCount as `remaining`
- FROM domains ORDER BY domain DESC LIMIT 0, 1;
- SELECT SLEEP(@SecondsToPause) INTO @SleepValue;
- SELECT COUNT(*) INTO @CurrentCount FROM domains;
- SET @Remaining = 456976 - @CurrentCount;
- END $$
- DELIMITER ;
- set MYSQL_USER=root
- set MYSQL_PASS=password
- set MYSQL_MYDB=mydatabase
- set MYSQL_CONN=-u%MYSQL_USER% -p%MYSQL_PASS% -D%MYSQL_MYDB%
- mysql %MYSQL_CONN% -ANe"CALL MyDataStatus()"
- mysql %MYSQL_CONN%
- mysql> CALL MyDataStatus();
- watch -n 10 'mysql --database=dbname --user=username --password=$(cat /path/to/file/with/mysql/password) --execute="select *, (select count(*) from domains) as count, (select 456976-count(*) from domains) as remaining from domains order by domain desc limit 0, 1;"'
- while true; do mysql -u root -p[password] -e "select * from table"; sleep 5; clear; done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement